Skip to content

Avoid confusing TS9025 error in isolatedDeclarations #60129

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

Merged

Conversation

Andarist
Copy link
Contributor

@Andarist Andarist commented Oct 3, 2024

fixes #60123

Copy link
Member

@jakebailey jakebailey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is okay; erroring code will emit an error elsewhere, so letting declaredParameterTypeContainsUndefined "lie" a little to prevent follow-ons feels fine.

@jakebailey
Copy link
Member

jakebailey commented Oct 11, 2024

And in the case like:

// @ts-ignore
import { DoesNotExist } from "foo";

export class Bar {
    constructor(private x?: DoesNotExist | undefined) {}
}

The "worst thing" that happens here is that | undefined is spuriously left behind. Probably that's worth a test?

@jakebailey
Copy link
Member

Ah, you already have that as a test via Unresolved.


export function test1(x?: Array | undefined): void {}

export function test2(x?: Unresolved | undefined): void {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
export function test2(x?: Unresolved | undefined): void {}
export function test2(x?: Unresolved | undefined): void {}
export function test3(x?: Unresolved): void {}

Maybe this extra test would be valuable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, i just pushed it out

@typescript-bot typescript-bot added For Backlog Bug PRs that fix a backlog bug and removed For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Oct 11, 2024
@jakebailey jakebailey merged commit f53d6dd into microsoft:main Oct 11, 2024
32 checks passed
@sandersn sandersn removed this from PR Backlog Apr 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Backlog Bug PRs that fix a backlog bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Impossible to annotate parameter properties in an isolatedDeclarations compatible way
3 participants