Closed
Description
From @greyepoxy on October 18, 2017 0:0
- VSCode Version: Code 1.17.1 (1e9d36539b0ae51ac09b9d4673ebea4e447e5353, 2017-10-10T14:24:50.851Z)
- OS Version: Windows_NT x64 10.0.14393
- TS version: 2.5.3
Steps to Reproduce:
- I have this code:
// In someTypes.ts file
export type Dictionary<T> = {
[key: string]: T;
};
export type A = string | string[];
export type B = Dictionary<A>;
// In someOtherFile.ts
import { A, B, Dictionary} from './someTypes';
function doThing(): void {
const aBunchOfA: Dictionary<B> = {};
aBunchOfA['key'] = { a: 'thing' };
}
- Highlight
aBunchOfA['key'] = { a: 'thing' };
insomeOtherFile.ts
- Show Fixes (Ctrl+.) -> extract function into module scope
Expected:
// In someOtherFile.ts
import { A, B, Dictionary} from './someTypes';
function doThing(): void {
const aBunchOfA: Dictionary<B> = {};
newFunction(aBunchOfA);
}
function newFunction(aBunchOfA: Dictionary<B>) {
aBunchOfA['key'] = { a: 'thing' };
}
Actual:
// In someOtherFile.ts
import { A, B, Dictionary} from './someTypes';
function doThing(): void {
const aBunchOfA: Dictionary<B> = {};
newFunction(aBunchOfA);
}
function newFunction(aBunchOfA: { [key: string]: Dictionary; }) { //<-- Dictionary underlined in red
aBunchOfA['key'] = { a: 'thing' };
}
severity: 'Error'
message: 'Generic type 'Dictionary' requires 1 type argument(s).'
at: '8,50'
source: 'ts'
Reproduces without extensions: Yes
Copied from original issue: microsoft/vscode#36453