Skip to content
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

--isolatedDeclarations allows generator functions #58334

Open
lucacasonato opened this issue Apr 26, 2024 · 1 comment
Open

--isolatedDeclarations allows generator functions #58334

lucacasonato opened this issue Apr 26, 2024 · 1 comment
Labels
Bug A bug in TypeScript Help Wanted You can do this
Milestone

Comments

@lucacasonato
Copy link

πŸ”Ž Search Terms

  • generator functions
  • isolated declartions
  • yield

πŸ•— Version & Regression Information

5.5.0-dev.20240426

⏯ Playground Link

https://www.typescriptlang.org/play/?isolatedDeclarations=true&ts=5.5.0-dev.20240426#code/KYDwDg9gTgLgBAMwK4DsDGMCWEUCo4CGAzgCYAUAlHAN4BQcDcAnpsADYlwBMA3PYy3acAzH0ZwowGEigo4ARloBfIA

πŸ’» Code

export function* asd() {
    yield 2;
    yield 3;
    return 1
}

πŸ™ Actual behavior

This is allowed, the following code is emitted even though it requires inference:

export declare function asd(): Generator<2 | 3, number, unknown>;

πŸ™‚ Expected behavior

This is disallowed (probably all generator functions)

Additional information about the issue

cc @dragomirtitian

@dragomirtitian
Copy link
Contributor

Thank you for reporting this. I do have a fix for it in a pr that's coming on Monday.

@RyanCavanaugh RyanCavanaugh added Bug A bug in TypeScript Help Wanted You can do this labels Apr 26, 2024
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Help Wanted You can do this
Projects
None yet
Development

No branches or pull requests

3 participants