-
Notifications
You must be signed in to change notification settings - Fork 719
fix(parser): panic when parsing JSDoc @satisfies with export assignments #1647
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
Merged
jakebailey
merged 4 commits into
microsoft:main
from
camc314:c/fix-export-assignment-initializer-panic
Sep 3, 2025
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
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
29 changes: 29 additions & 0 deletions
29
testdata/baselines/reference/compiler/panicSatisfiesOnExportEqualsDeclaration.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,29 @@ | ||
panicSatisfiesOnExportEqualsDeclaration.js(2,14): error TS2585: 'Symbol' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the 'lib' compiler option to es2015 or later. | ||
panicSatisfiesOnExportEqualsDeclaration.js(5,23): error TS2307: Cannot find module './types' or its corresponding type declarations. | ||
|
||
|
||
==== types.d.ts (0 errors) ==== | ||
export interface SupportVersionTraceMap { | ||
zlib?: any; | ||
'node:zlib'?: any; | ||
} | ||
|
||
==== panicSatisfiesOnExportEqualsDeclaration.js (2 errors) ==== | ||
const zlib = {}; | ||
const READ = Symbol('read'); | ||
~~~~~~ | ||
!!! error TS2585: 'Symbol' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the 'lib' compiler option to es2015 or later. | ||
|
||
/** | ||
* @satisfies {import('./types').SupportVersionTraceMap} | ||
~~~~~~~~~ | ||
!!! error TS2307: Cannot find module './types' or its corresponding type declarations. | ||
*/ | ||
module.exports = { | ||
zlib: zlib, | ||
'node:zlib': { | ||
...zlib, | ||
[READ]: { supported: ['14.13.1', '12.20.0'] }, | ||
}, | ||
}; | ||
|
46 changes: 46 additions & 0 deletions
46
testdata/baselines/reference/compiler/panicSatisfiesOnExportEqualsDeclaration.symbols
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,46 @@ | ||
//// [tests/cases/compiler/panicSatisfiesOnExportEqualsDeclaration.ts] //// | ||
|
||
=== types.d.ts === | ||
export interface SupportVersionTraceMap { | ||
>SupportVersionTraceMap : Symbol(SupportVersionTraceMap, Decl(types.d.ts, 0, 0)) | ||
|
||
zlib?: any; | ||
>zlib : Symbol(SupportVersionTraceMap.zlib, Decl(types.d.ts, 0, 41)) | ||
|
||
'node:zlib'?: any; | ||
>'node:zlib' : Symbol(SupportVersionTraceMap["node:zlib"], Decl(types.d.ts, 1, 15)) | ||
} | ||
|
||
=== panicSatisfiesOnExportEqualsDeclaration.js === | ||
const zlib = {}; | ||
>zlib : Symbol(zlib, Decl(panicSatisfiesOnExportEqualsDeclaration.js, 0, 5)) | ||
|
||
const READ = Symbol('read'); | ||
>READ : Symbol(READ, Decl(panicSatisfiesOnExportEqualsDeclaration.js, 1, 5)) | ||
|
||
/** | ||
* @satisfies {import('./types').SupportVersionTraceMap} | ||
*/ | ||
module.exports = { | ||
>module.exports : Symbol(export=, Decl(panicSatisfiesOnExportEqualsDeclaration.js, 1, 28)) | ||
>module : Symbol(module.exports) | ||
>exports : Symbol(export=, Decl(panicSatisfiesOnExportEqualsDeclaration.js, 1, 28)) | ||
|
||
zlib: zlib, | ||
>zlib : Symbol(zlib, Decl(panicSatisfiesOnExportEqualsDeclaration.js, 6, 18)) | ||
>zlib : Symbol(zlib, Decl(panicSatisfiesOnExportEqualsDeclaration.js, 0, 5)) | ||
|
||
'node:zlib': { | ||
>'node:zlib' : Symbol('node:zlib', Decl(panicSatisfiesOnExportEqualsDeclaration.js, 7, 15)) | ||
|
||
...zlib, | ||
>zlib : Symbol(zlib, Decl(panicSatisfiesOnExportEqualsDeclaration.js, 0, 5)) | ||
|
||
[READ]: { supported: ['14.13.1', '12.20.0'] }, | ||
>[READ] : Symbol([READ], Decl(panicSatisfiesOnExportEqualsDeclaration.js, 9, 16)) | ||
>READ : Symbol(READ, Decl(panicSatisfiesOnExportEqualsDeclaration.js, 1, 5)) | ||
>supported : Symbol(supported, Decl(panicSatisfiesOnExportEqualsDeclaration.js, 10, 17)) | ||
|
||
}, | ||
}; | ||
|
55 changes: 55 additions & 0 deletions
55
testdata/baselines/reference/compiler/panicSatisfiesOnExportEqualsDeclaration.types
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,55 @@ | ||
//// [tests/cases/compiler/panicSatisfiesOnExportEqualsDeclaration.ts] //// | ||
|
||
=== types.d.ts === | ||
export interface SupportVersionTraceMap { | ||
zlib?: any; | ||
>zlib : any | ||
|
||
'node:zlib'?: any; | ||
>'node:zlib' : any | ||
} | ||
|
||
=== panicSatisfiesOnExportEqualsDeclaration.js === | ||
const zlib = {}; | ||
>zlib : {} | ||
>{} : {} | ||
|
||
const READ = Symbol('read'); | ||
>READ : any | ||
>Symbol('read') : any | ||
>Symbol : any | ||
>'read' : "read" | ||
|
||
/** | ||
* @satisfies {import('./types').SupportVersionTraceMap} | ||
*/ | ||
module.exports = { | ||
>module.exports = { zlib: zlib, 'node:zlib': { ...zlib, [READ]: { supported: ['14.13.1', '12.20.0'] }, },} : any | ||
>module.exports : any | ||
>module : { "export=": any; } | ||
>exports : any | ||
>{ zlib: zlib, 'node:zlib': { ...zlib, [READ]: { supported: ['14.13.1', '12.20.0'] }, },} : { zlib: {}; "node:zlib": {}; } | ||
|
||
zlib: zlib, | ||
>zlib : {} | ||
>zlib : {} | ||
|
||
'node:zlib': { | ||
>'node:zlib' : {} | ||
>{ ...zlib, [READ]: { supported: ['14.13.1', '12.20.0'] }, } : {} | ||
|
||
...zlib, | ||
>zlib : {} | ||
|
||
[READ]: { supported: ['14.13.1', '12.20.0'] }, | ||
>[READ] : { supported: string[]; } | ||
>READ : any | ||
>{ supported: ['14.13.1', '12.20.0'] } : { supported: string[]; } | ||
>supported : string[] | ||
>['14.13.1', '12.20.0'] : string[] | ||
>'14.13.1' : "14.13.1" | ||
>'12.20.0' : "12.20.0" | ||
|
||
}, | ||
}; | ||
|
24 changes: 24 additions & 0 deletions
24
testdata/tests/cases/compiler/panicSatisfiesOnExportEqualsDeclaration.ts
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 @@ | ||
// @allowJs: true | ||
// @checkJs: true | ||
// @noEmit: true | ||
// @module: commonjs | ||
// @Filename: types.d.ts | ||
export interface SupportVersionTraceMap { | ||
zlib?: any; | ||
'node:zlib'?: any; | ||
} | ||
|
||
// @Filename: panicSatisfiesOnExportEqualsDeclaration.js | ||
jakebailey marked this conversation as resolved.
Show resolved
Hide resolved
|
||
const zlib = {}; | ||
const READ = Symbol('read'); | ||
|
||
/** | ||
* @satisfies {import('./types').SupportVersionTraceMap} | ||
*/ | ||
module.exports = { | ||
zlib: zlib, | ||
'node:zlib': { | ||
...zlib, | ||
[READ]: { supported: ['14.13.1', '12.20.0'] }, | ||
}, | ||
}; |
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.