-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(typescript): Remove the usages of private members (#10037)
**Related issue:** - Closes #10034
- Loading branch information
Showing
7 changed files
with
112 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
swc_core: patch | ||
swc_typescript: patch | ||
--- | ||
|
||
fix(typescript): Remove the usage of private members |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
```==================== .D.TS ==================== | ||
export declare class SomeClass { | ||
private func; | ||
private func2; | ||
} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const A_SYMBOL = Symbol("A_SYMBOL"); | ||
const func = () => null; | ||
|
||
export class SomeClass { | ||
private func( | ||
queryFingerprint: string, | ||
onStale: () => void | ||
): null | typeof A_SYMBOL { | ||
return null; | ||
} | ||
|
||
private func2( | ||
queryFingerprint: string, | ||
onStale: () => void | ||
): null | typeof func { | ||
return null; | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
crates/swc_typescript/tests/fixture/private-accessibility.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
```==================== .D.TS ==================== | ||
export declare class A { | ||
private p1; | ||
private constructor(); | ||
private accessor myProperty; | ||
private func1; | ||
} | ||
export declare class B { | ||
private a; | ||
private constructor(); | ||
} | ||
export declare class C { | ||
#private; | ||
} | ||
20 changes: 20 additions & 0 deletions
20
crates/swc_typescript/tests/fixture/private-accessibility.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const A_SYMBOL = Symbol("A_SYMBOL"); | ||
|
||
export class A { | ||
private p1: typeof A_SYMBOL; | ||
private constructor(a: typeof A_SYMBOL) {} | ||
private accessor myProperty: typeof A_SYMBOL; | ||
private func1(a: typeof A_SYMBOL): typeof A_SYMBOL | null { | ||
return null; | ||
} | ||
} | ||
|
||
export class B { | ||
private constructor(private a: typeof A_SYMBOL) {} | ||
} | ||
|
||
export class C { | ||
#p1: typeof A_SYMBOL; | ||
accessor #myProperty: typeof A_SYMBOL; | ||
#f(a: typeof A_SYMBOL) {} | ||
} |