You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
when we use union types, editor can't provide any suggestions.
typea="a"|"b"|string// typeof a:stringletv:av="a"// β but without suggestionv="other"// β
If we remove string from the union type, we wouldn't be able to set v to any other value.
typea="a"|"b"// typeof a:"a"|"b"letv:av="a"// β with suggestionv="other"// β
I hope editor can give suggestion about "a"or"b"
π Motivating Example
we can give optional value suggestion to user, but user can use other type without error
π» Use Cases
What do you want to use this for?
like document.body.style.borderWidth='inherit'οΌeditor can give 'inherit'|'thin' and so on, but other string can be set.
What shortcomings exist with current approaches?
editor can't give more suggestions
What workarounds are you using in the meantime?
none
The text was updated successfully, but these errors were encountered:
π Search Terms
literals, union
β Viability Checklist
β Suggestion
when we use union types, editor can't provide any suggestions.
If we remove
string
from the union type, we wouldn't be able to setv
to any other value.I hope editor can give suggestion about "a"or"b"
π Motivating Example
we can give optional value suggestion to user, but user can use other type without error
π» Use Cases
like
document.body.style.borderWidth='inherit'
οΌeditor can give 'inherit'|'thin' and so on, but other string can be set.editor can't give more suggestions
none
The text was updated successfully, but these errors were encountered: