Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Fix const type parameters in TSX#1073

Open
phryneas wants to merge 1 commit into
microsoft:mastermicrosoft/TypeScript-TmLanguage:masterfrom
phryneas:pr/fix-constTypeParameter-in-tsxphryneas/TypeScript-TmLanguage:pr/fix-constTypeParameter-in-tsxCopy head branch name to clipboard
Open

Fix const type parameters in TSX#1073
phryneas wants to merge 1 commit into
microsoft:mastermicrosoft/TypeScript-TmLanguage:masterfrom
phryneas:pr/fix-constTypeParameter-in-tsxphryneas/TypeScript-TmLanguage:pr/fix-constTypeParameter-in-tsxCopy head branch name to clipboard

Conversation

@phryneas
Copy link
Copy Markdown

@phryneas phryneas commented May 18, 2026

fixes #979

I tried to reuse existing tests as far as possible - this should finally fix synax highlighing for <const Foo extends Bar> kind type parameters.

@@ -1,4 +1,3 @@
// @onlyOwnGrammar - this has type parameters that would be jsx in tsx files
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test now works with both ts and tsx

foo<const U>(x: U) { return x; }
}
const C2 = class <const T> {}
const fx1 = <const T>(x: T) => x;
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is ambiguous in tsx - moved into a separate test

source.ts meta.var.expr.ts meta.class.ts punctuation.definition.block.ts
^
source.ts meta.var.expr.ts meta.class.ts punctuation.definition.block.ts
>const fx1 = <const T>(x: T) => x;
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This just moved to the other file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TypeScript's const modifier on type parameteres breaks syntax highlighting in .tsx files

1 participant

Morty Proxy This is a proxified and sanitized view of the page, visit original site.