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
I have two generic indexed types
type ExtendedService<T> = { [K in keyof T]: T[K] & { __$daemonMode?: string; __$action?: string; }; }; type Service<T> = { [K in keyof T]: T[K] & {id?: string}; };
And use them like this
export const createService = <T>( ServiceCtr: ExtendedService<T> & Service<T> ) => { ... Object.keys(ServiceCtr).forEach(key => { const method = (ServiceCtr)[key as keyof T]; const {__$daemonMode, __$action, id} = method; ... } }
VS Code output for method type is
method
const method: ({ [K in keyof T]: T[K] & { __$daemonMode?: string; __$action?: string; }; } & Service<T>)[keyof T]
Expected behavior:
properties __$daemonMode, __$action, id exists on method variable; const {__$daemonMode, __$action, id} = method; has no errors;
__$daemonMode
__$action
id
const {__$daemonMode, __$action, id} = method;
Actual behavior:
I got an error
[ts] Type '(ExtendedService<T> & Service<T>)[keyof T]' has no property '__$daemonMode' and no string index signature.
__$action and id produces the same error;
P.S.
Expression
const x: (ExtendedService<{z: {}}> & Service<{z: {}}>)['z']; const {__$daemonMode, __$action, id} = x;
works as expected
The text was updated successfully, but these errors were encountered:
Fixed by #26281
Sorry, something went wrong.
weswigham
Successfully merging a pull request may close this issue.
I have two generic indexed types
And use them like this
VS Code output for
method
type isExpected behavior:
properties
__$daemonMode
,__$action
,id
exists onmethod
variable;const {__$daemonMode, __$action, id} = method;
has no errors;Actual behavior:
I got an error
__$action
andid
produces the same error;P.S.
Expression
works as expected
The text was updated successfully, but these errors were encountered: