Closed
Description
typescript: 4.7.0-dev.20220327
vscode: 1.66.0-insider
reproduce:
- install extension JavaScript and TypeScript Nightly
- toggle to latest typescript
- copy following code
- restart vscode
class Tex {
type = 'Text' as const;
}
class Svg {
type = 'Svg' as const;
}
const map = {
text: Tex,
svg: Svg
}
type M = typeof map;
export function bar<T extends keyof M>(type: T): M[T] {
const s = map[type];
return s;
}
const cons = bar('text');
const a = new cons();
const t = s.type;