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

Isolated declarations emit is different from TSC #4033

Open
escaton opened this issue Jul 2, 2024 · 1 comment
Open

Isolated declarations emit is different from TSC #4033

escaton opened this issue Jul 2, 2024 · 1 comment
Labels
C-bug Category - Bug

Comments

@escaton
Copy link
Contributor

escaton commented Jul 2, 2024

Given

export class Boo {
  constructor(
    public readonly prop: number = 0,
    private readonly prop2: number = 1,
    readonly prop3: number = 1,
  ) {}
}

Oxc generates:

export declare class Boo {
	readonly prop: number;
	private readonly prop2: number;
	readonly prop3: number;
	constructor(prop?: number, prop2?: number, prop3?: number);
}

TSC:

export declare class Boo {
    readonly prop: number;
    private readonly prop2;
    readonly prop3: number;
    constructor(prop?: number, prop2?: number, prop3?: number);
}
@Dunqing
Copy link
Member

Dunqing commented Jul 2, 2024

If param.accessibility is private we can give type_annotation as None

if param.accessibility.is_some() {
// transformed params will definitely have type annotation
let type_annotation = self.ast.copy(&params.items[index].pattern.type_annotation);
if let Some(new_element) =
self.transform_formal_parameter_to_class_property(param, type_annotation)
{
elements.push(new_element);
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category - Bug
Projects
None yet
Development

No branches or pull requests

2 participants