-
Notifications
You must be signed in to change notification settings - Fork 13k
Implement TypeScript 6.0 deprecation of module
keyword for namespace declarations
#62390
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
Draft
Copilot
wants to merge
13
commits into
main
Choose a base branch
from
copilot/fix-62211
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+24,558
−22,010
Draft
Changes from 9 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
88b137f
Initial plan
Copilot 7cbbb7e
Implement TypeScript 6.0 deprecation of module keyword for namespaces
Copilot 381d4a6
Apply code formatting
Copilot dcfee6e
Update test baselines for module keyword deprecation errors
Copilot 3a60026
Remove version comparison logic and fix diagnostic message ordering
Copilot 0ebcdd1
Update test files to use namespace instead of module keyword
Copilot e6ee96d
Fix lint errors by removing unused imports and apply formatting
Copilot 8387013
Update additional test files with comprehensive module-to-namespace r…
Copilot 492692e
Fix code style and update test files to use namespace instead of module
Copilot e93fa38
Update remaining test files to use namespace instead of module keyword
Copilot 6e09dc2
Update baselines
RyanCavanaugh 116285f
Update remaining test files to replace module with namespace declarat…
Copilot 3e0cdbd
Fix all remaining module declarations in test files
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
17 changes: 17 additions & 0 deletions
17
...aselines/reference/AmbientModuleAndAmbientFunctionWithTheSameNameAndCommonRoot.errors.txt
This file contains hidden or 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 @@ | ||
module.d.ts(1,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. | ||
|
||
|
||
==== module.d.ts (1 errors) ==== | ||
declare module Point { | ||
~~~~~~ | ||
!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. | ||
export var Origin: { x: number; y: number; } | ||
} | ||
|
||
==== function.d.ts (0 errors) ==== | ||
declare function Point(): { x: number; y: number; } | ||
|
||
==== test.ts (0 errors) ==== | ||
var cl: { x: number; y: number; } | ||
var cl = Point(); | ||
var cl = Point.Origin; |
19 changes: 19 additions & 0 deletions
19
...lines/reference/AmbientModuleAndNonAmbientFunctionWithTheSameNameAndCommonRoot.errors.txt
This file contains hidden or 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,19 @@ | ||
module.d.ts(1,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. | ||
|
||
|
||
==== module.d.ts (1 errors) ==== | ||
declare module Point { | ||
~~~~~~ | ||
!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. | ||
export var Origin: { x: number; y: number; } | ||
} | ||
|
||
==== function.ts (0 errors) ==== | ||
function Point() { | ||
return { x: 0, y: 0 }; | ||
} | ||
|
||
==== test.ts (0 errors) ==== | ||
var cl: { x: number; y: number; } | ||
var cl = Point(); | ||
var cl = Point.Origin; |
This file contains hidden or 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
22 changes: 22 additions & 0 deletions
22
tests/baselines/reference/EnumAndModuleWithSameNameAndCommonRoot.errors.txt
This file contains hidden or 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,22 @@ | ||
EnumAndModuleWithSameNameAndCommonRoot.ts(5,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. | ||
|
||
|
||
==== EnumAndModuleWithSameNameAndCommonRoot.ts (1 errors) ==== | ||
enum enumdule { | ||
Red, Blue | ||
} | ||
|
||
module enumdule { | ||
~~~~~~ | ||
!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. | ||
|
||
export class Point { | ||
constructor(public x: number, public y: number) { } | ||
} | ||
} | ||
|
||
var x: enumdule; | ||
var x = enumdule.Red; | ||
|
||
var y: { x: number; y: number }; | ||
var y = new enumdule.Point(0, 0); |
25 changes: 25 additions & 0 deletions
25
tests/baselines/reference/ExportClassWhichExtendsInterfaceWithInaccessibleType.errors.txt
This file contains hidden or 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,25 @@ | ||
ExportClassWhichExtendsInterfaceWithInaccessibleType.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. | ||
|
||
|
||
==== ExportClassWhichExtendsInterfaceWithInaccessibleType.ts (1 errors) ==== | ||
module A { | ||
~~~~~~ | ||
!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. | ||
|
||
interface Point { | ||
x: number; | ||
y: number; | ||
|
||
fromOrigin(p: Point): number; | ||
} | ||
|
||
export class Point2d implements Point { | ||
constructor(public x: number, public y: number) { } | ||
|
||
fromOrigin(p: Point) { | ||
return 1; | ||
} | ||
} | ||
} | ||
|
||
|
21 changes: 21 additions & 0 deletions
21
.../reference/ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.errors.txt
This file contains hidden or 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,21 @@ | ||
ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. | ||
|
||
|
||
==== ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.ts (1 errors) ==== | ||
module A { | ||
~~~~~~ | ||
!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. | ||
|
||
export class Point { | ||
x: number; | ||
y: number; | ||
} | ||
|
||
export class Line { | ||
constructor(public start: Point, public end: Point) { } | ||
} | ||
|
||
export function fromOrigin(p: Point): Line { | ||
return new Line({ x: 0, y: 0 }, p); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
...selines/reference/ExportFunctionWithInaccessibleTypesInParameterTypeAnnotation.errors.txt
This file contains hidden or 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,21 @@ | ||
ExportFunctionWithInaccessibleTypesInParameterTypeAnnotation.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. | ||
|
||
|
||
==== ExportFunctionWithInaccessibleTypesInParameterTypeAnnotation.ts (1 errors) ==== | ||
module A { | ||
~~~~~~ | ||
!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. | ||
|
||
class Point { | ||
x: number; | ||
y: number; | ||
} | ||
|
||
export class Line { | ||
constructor(public start: Point, public end: Point) { } | ||
} | ||
|
||
export function fromOrigin(p: Point): Line { | ||
return new Line({ x: 0, y: 0 }, p); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
.../baselines/reference/ExportFunctionWithInaccessibleTypesInReturnTypeAnnotation.errors.txt
This file contains hidden or 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,21 @@ | ||
ExportFunctionWithInaccessibleTypesInReturnTypeAnnotation.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. | ||
|
||
|
||
==== ExportFunctionWithInaccessibleTypesInReturnTypeAnnotation.ts (1 errors) ==== | ||
module A { | ||
~~~~~~ | ||
!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. | ||
|
||
export class Point { | ||
x: number; | ||
y: number; | ||
} | ||
|
||
class Line { | ||
constructor(public start: Point, public end: Point) { } | ||
} | ||
|
||
export function fromOrigin(p: Point): Line { | ||
return new Line({ x: 0, y: 0 }, p); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
...ectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.errors.txt
This file contains hidden or 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 @@ | ||
ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. | ||
|
||
|
||
==== ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.ts (1 errors) ==== | ||
module A { | ||
~~~~~~ | ||
!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. | ||
|
||
class Point { | ||
constructor(public x: number, public y: number) { } | ||
} | ||
|
||
export var UnitSquare : { | ||
top: { left: Point, right: Point }, | ||
bottom: { left: Point, right: Point } | ||
} = null; | ||
} |
24 changes: 24 additions & 0 deletions
24
tests/baselines/reference/ExportVariableWithInaccessibleTypeInTypeAnnotation.errors.txt
This file contains hidden or 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,24 @@ | ||
ExportVariableWithInaccessibleTypeInTypeAnnotation.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. | ||
|
||
|
||
==== ExportVariableWithInaccessibleTypeInTypeAnnotation.ts (1 errors) ==== | ||
module A { | ||
~~~~~~ | ||
!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. | ||
|
||
export interface Point { | ||
x: number; | ||
y: number; | ||
} | ||
|
||
// valid since Point is exported | ||
export var Origin: Point = { x: 0, y: 0 }; | ||
|
||
interface Point3d extends Point { | ||
z: number; | ||
} | ||
|
||
// invalid Point3d is not exported | ||
export var Origin3d: Point3d = { x: 0, y: 0, z: 0 }; | ||
} | ||
|
32 changes: 32 additions & 0 deletions
32
tests/baselines/reference/FunctionAndModuleWithSameNameAndDifferentCommonRoot.errors.txt
This file contains hidden or 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,32 @@ | ||
function.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. | ||
module.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. | ||
module.ts(2,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. | ||
|
||
|
||
==== function.ts (1 errors) ==== | ||
module A { | ||
~~~~~~ | ||
!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. | ||
export function Point() { | ||
return { x: 0, y: 0 }; | ||
} | ||
} | ||
|
||
==== module.ts (2 errors) ==== | ||
module B { | ||
~~~~~~ | ||
!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. | ||
export module Point { | ||
~~~~~~ | ||
!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. | ||
export var Origin = { x: 0, y: 0 }; | ||
} | ||
} | ||
|
||
==== test.ts (0 errors) ==== | ||
var fn: () => { x: number; y: number }; | ||
var fn = A.Point; | ||
|
||
var cl: { x: number; y: number; } | ||
var cl = B.Point.Origin; | ||
|
22 changes: 22 additions & 0 deletions
22
tests/baselines/reference/ModuleAndEnumWithSameNameAndCommonRoot.errors.txt
This file contains hidden or 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,22 @@ | ||
ModuleAndEnumWithSameNameAndCommonRoot.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. | ||
|
||
|
||
==== ModuleAndEnumWithSameNameAndCommonRoot.ts (1 errors) ==== | ||
module enumdule { | ||
~~~~~~ | ||
!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. | ||
|
||
export class Point { | ||
constructor(public x: number, public y: number) { } | ||
} | ||
} | ||
|
||
enum enumdule { | ||
Red, Blue | ||
} | ||
|
||
var x: enumdule; | ||
var x = enumdule.Red; | ||
|
||
var y: { x: number; y: number }; | ||
var y = new enumdule.Point(0, 0); |
This file contains hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.