We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What is the reason for disallowing generic type aliases?
I know you can use an empty interface definition to achieve the same thing, such as:
interface KO<T> extends KnockoutObservable<T> {}
But the limitation with interfaces is you can't use primitives or union types.
I want to be able to write:
type KnockoutWrapped<T> = T | KnockoutObservable<T>; // or: type KW<T> = T | KO<T>; // ensure I call ko.unwrap to get value
But my only option right now is:
type KnockoutWrappedString = string | KnockoutObservable<string>; type KnockoutWrappedNumber = number | KnockoutObservable<number>; type KnockoutWrappedBoolean = boolean | KnockoutObservable<boolean>; // ... // or: type KWString = string | KO<string>; type KWNumber = number | KO<number>; type KWBoolean = boolean | KO<boolean>;
Which:
string
number
boolean
interface KOString extends KnockoutObservableString {} interface KONumber extends KnockoutObservableNumber {} interface KOBoolean extends KnockoutObservableBoolean {} // ...
The text was updated successfully, but these errors were encountered:
See #1616
Sorry, something went wrong.
No branches or pull requests
What is the reason for disallowing generic type aliases?
I know you can use an empty interface definition to achieve the same thing, such as:
But the limitation with interfaces is you can't use primitives or union types.
I want to be able to write:
But my only option right now is:
Which:
string
,number
andboolean
in blue, andThe text was updated successfully, but these errors were encountered: