TypeScript/tests/cases/fourslash/codeFixInferFromUsageContextualImport3.ts
Andrew Branch e146f0d13d
Allow inferFromUsage to do auto-imports (#33915)
* Add test

* Auto-import instead of using ImportTypeNodes

* Write more tests and fix namespace case

* Remove unused enum memmber

* Update API baselines

* Lint

* Style nits and util consolidation
2019-10-14 10:33:00 -07:00

33 lines
683 B
TypeScript

/// <reference path="fourslash.ts" />
// @strict: true
// @noImplicitAny: true
// @noLib: true
// @Filename: /a.ts
////export namespace things {
//// export namespace stuff {
//// export class User<T> {}
//// }
////}
////export declare function getEmail<T>(thing: T, user: things.stuff.User<T>): string;
// @Filename: /b.ts
////import { getEmail } from "./a";
////
////export function f([|user|]) {
//// getEmail(42, user);
////}
goTo.file("/b.ts");
verify.codeFix({
description: "Infer parameter types from usage",
newFileContent:
`import { getEmail, things } from "./a";
export function f(user: things.stuff.User<number>) {
getEmail(42, user);
}`
});