Skip to content

"Add extends constraint" doesn't auto-import dependencies #49965

New issue

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

Closed
DanielRosenwasser opened this issue Jul 19, 2022 · 0 comments · Fixed by #50004
Closed

"Add extends constraint" doesn't auto-import dependencies #49965

DanielRosenwasser opened this issue Jul 19, 2022 · 0 comments · Fixed by #50004
Assignees
Labels
Bug A bug in TypeScript Domain: Quick Fixes Editor-provided fixes, often called code actions. Effort: Casual Good issue if you're already used to contributing to the codebase. Harder than "good first issue". Fix Available A PR has been opened for this issue Help Wanted You can do this

Comments

@DanielRosenwasser
Copy link
Member

// @filename: bar.ts
export type MyType = Record<string, string>

export function bar<T extends MyType>(obj: { prop: T }) {}

// @filename: foo.ts
import { bar } from "./bar";

function foo<T>(x: T) {
    bar({ prop: x })
}

Expected

import { bar, MyType } from "./bar";

function foo<T extends MyType>(x: T) {
    bar({ prop: x })
}

Actual

import { bar } from "./bar";

function foo<T extends MyType>(x: T) {
    bar({ prop: x })
}
@DanielRosenwasser DanielRosenwasser added Bug A bug in TypeScript Help Wanted You can do this Domain: Quick Fixes Editor-provided fixes, often called code actions. Effort: Casual Good issue if you're already used to contributing to the codebase. Harder than "good first issue". labels Jul 20, 2022
@DanielRosenwasser DanielRosenwasser added this to the TypeScript 4.8.1 milestone Jul 20, 2022
@typescript-bot typescript-bot added the Fix Available A PR has been opened for this issue label Jul 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Domain: Quick Fixes Editor-provided fixes, often called code actions. Effort: Casual Good issue if you're already used to contributing to the codebase. Harder than "good first issue". Fix Available A PR has been opened for this issue Help Wanted You can do this
Projects
None yet
3 participants