|
| 1 | +=== tests/cases/compiler/cachedContextualTypes.ts === |
| 2 | +// Repro from #52198 |
| 3 | + |
| 4 | +declare function createInstance<Ctor extends new (...args: any[]) => any, R extends InstanceType<Ctor>>(ctor: Ctor, ...args: ConstructorParameters<Ctor>): R; |
| 5 | +>createInstance : Symbol(createInstance, Decl(cachedContextualTypes.ts, 0, 0)) |
| 6 | +>Ctor : Symbol(Ctor, Decl(cachedContextualTypes.ts, 2, 32)) |
| 7 | +>args : Symbol(args, Decl(cachedContextualTypes.ts, 2, 50)) |
| 8 | +>R : Symbol(R, Decl(cachedContextualTypes.ts, 2, 73)) |
| 9 | +>InstanceType : Symbol(InstanceType, Decl(lib.es5.d.ts, --, --)) |
| 10 | +>Ctor : Symbol(Ctor, Decl(cachedContextualTypes.ts, 2, 32)) |
| 11 | +>ctor : Symbol(ctor, Decl(cachedContextualTypes.ts, 2, 104)) |
| 12 | +>Ctor : Symbol(Ctor, Decl(cachedContextualTypes.ts, 2, 32)) |
| 13 | +>args : Symbol(args, Decl(cachedContextualTypes.ts, 2, 115)) |
| 14 | +>ConstructorParameters : Symbol(ConstructorParameters, Decl(lib.es5.d.ts, --, --)) |
| 15 | +>Ctor : Symbol(Ctor, Decl(cachedContextualTypes.ts, 2, 32)) |
| 16 | +>R : Symbol(R, Decl(cachedContextualTypes.ts, 2, 73)) |
| 17 | + |
| 18 | +export interface IMenuWorkbenchToolBarOptions { |
| 19 | +>IMenuWorkbenchToolBarOptions : Symbol(IMenuWorkbenchToolBarOptions, Decl(cachedContextualTypes.ts, 2, 157)) |
| 20 | + |
| 21 | + toolbarOptions: { |
| 22 | +>toolbarOptions : Symbol(IMenuWorkbenchToolBarOptions.toolbarOptions, Decl(cachedContextualTypes.ts, 4, 47)) |
| 23 | + |
| 24 | + foo(bar: string): string |
| 25 | +>foo : Symbol(foo, Decl(cachedContextualTypes.ts, 5, 21)) |
| 26 | +>bar : Symbol(bar, Decl(cachedContextualTypes.ts, 6, 12)) |
| 27 | + |
| 28 | + }; |
| 29 | +} |
| 30 | + |
| 31 | +class MenuWorkbenchToolBar { |
| 32 | +>MenuWorkbenchToolBar : Symbol(MenuWorkbenchToolBar, Decl(cachedContextualTypes.ts, 8, 1)) |
| 33 | + |
| 34 | + constructor( |
| 35 | + options: IMenuWorkbenchToolBarOptions | undefined, |
| 36 | +>options : Symbol(options, Decl(cachedContextualTypes.ts, 11, 16)) |
| 37 | +>IMenuWorkbenchToolBarOptions : Symbol(IMenuWorkbenchToolBarOptions, Decl(cachedContextualTypes.ts, 2, 157)) |
| 38 | + |
| 39 | + ) { } |
| 40 | +} |
| 41 | + |
| 42 | +createInstance(MenuWorkbenchToolBar, { |
| 43 | +>createInstance : Symbol(createInstance, Decl(cachedContextualTypes.ts, 0, 0)) |
| 44 | +>MenuWorkbenchToolBar : Symbol(MenuWorkbenchToolBar, Decl(cachedContextualTypes.ts, 8, 1)) |
| 45 | + |
| 46 | + toolbarOptions: { |
| 47 | +>toolbarOptions : Symbol(toolbarOptions, Decl(cachedContextualTypes.ts, 16, 38)) |
| 48 | + |
| 49 | + foo(bar) { return bar; } |
| 50 | +>foo : Symbol(foo, Decl(cachedContextualTypes.ts, 17, 21)) |
| 51 | +>bar : Symbol(bar, Decl(cachedContextualTypes.ts, 18, 12)) |
| 52 | +>bar : Symbol(bar, Decl(cachedContextualTypes.ts, 18, 12)) |
| 53 | + } |
| 54 | +}); |
| 55 | + |
0 commit comments