oxc/crates/oxc_isolated_declarations/tests/fixtures/class.ts
michaelm 8e80f593fd
fix(isolated_declarations): Class properties should still be lifted from private constructors (#4934)
Before, this
```ts
export class Bux {
  private constructor(
    public readonly prop: number = 0,
    private readonly prop2: number = 1,
    readonly prop3: number = 1,
  ) {}
}
```
would be emitted as 
```ts
export declare class Bux {
	private constructor();
}
```

Now it will be emitted as
```ts
export declare class Bux {
	readonly prop: number;
	private readonly prop2;
	readonly prop3: number;
	private constructor();
}
```

Co-authored-by: MichaelMitchell-at <=>
2024-08-16 21:43:44 +08:00

45 lines
846 B
TypeScript

export class Foo {
private constructor(a: number = 0) {}
}
export class Bar {
public constructor(a: number = 0) {}
}
export class Zoo {
foo<F>(f: F): F {
return f;
}
}
export abstract class Qux {
abstract foo(): void;
protected foo2?(): void;
bar(): void {}
baz(): void {}
}
export class Baz {
readonly prop1 = 'some string';
prop2 = 'another string';
private prop3 = 'yet another string';
private prop4(): void {}
private static prop5 = 'yet another string';
private static prop6(): void {}
}
export class Boo {
constructor(
public readonly prop: number = 0,
private readonly prop2: number = 1,
readonly prop3: number = 1,
) {}
}
export class Bux {
private constructor(
public readonly prop: number = 0,
private readonly prop2: number = 1,
readonly prop3: number = 1,
) {}
}