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

Transform doesn't work with type assertion in params #6179

Closed
aminpaks opened this issue Sep 30, 2024 · 1 comment · Fixed by #6181
Closed

Transform doesn't work with type assertion in params #6179

aminpaks opened this issue Sep 30, 2024 · 1 comment · Fixed by #6181
Assignees
Labels
A-isolated-declarations Isolated Declarations C-bug Category - Bug

Comments

@aminpaks
Copy link

aminpaks commented Sep 30, 2024

For a function with a type asserted parameters, oxc-transform reporting an error incorrectly.

Given this code:

interface T0 {}

export function test(_ = {} as T0): void {}

Current behaviour

Getting an error:

  x TS9011: Parameter must have an explicit type annotation with
  | --isolatedDeclarations.
   ,-[test.ts:3:32]
 2 | 
 3 | export function test(_ = {} as T0): void {}
   :                                ^^
   `----

Expected behaviour

According to TypeScript, this is valid, and generate dts bellow in Isolated Declaration:

export interface T0 {
}
export declare function test(_?: T0): void;

Playground link

@Dunqing
Copy link
Member

Dunqing commented Sep 30, 2024

Thanks for the feedback. This is a false positive, the result is correct

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-isolated-declarations Isolated Declarations C-bug Category - Bug
Projects
None yet
3 participants