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
TypeScript version: 2.0.8
export type State = { value: string, mode: Selecting | Selected, } type Selected = { type: 'selected', valid: boolean } type Selecting = { type: 'selecting', options: { type: 'loading', handle: number } | { type: 'loaded', selection: undefined | number, items: string[] } } function f(state: State) { if (state.mode.type === 'selecting' && state.mode.options.type === 'loaded') { const {options} = state.mode; const options2 = state.mode.options; options2.items; options.items; } }
Expected inside f, options and options2 should have the same type
f
options
options2
Actual options loses the narrowed type information
The text was updated successfully, but these errors were encountered:
Duplicate of #10065 and #10846.
Sorry, something went wrong.
No branches or pull requests
TypeScript version: 2.0.8
Expected
inside
f
,options
andoptions2
should have the same typeActual
options
loses the narrowed type informationThe text was updated successfully, but these errors were encountered: