diff --git a/data/language-specs/typescript-js-modules.lang b/data/language-specs/typescript-js-modules.lang index 63a693ddd..e943160ca 100644 --- a/data/language-specs/typescript-js-modules.lang +++ b/data/language-specs/typescript-js-modules.lang @@ -92,6 +92,42 @@ + + + + \%{js:before-next-token} + \%{js:statement-end} + + + + + + + + \%{typescript:type-keyword} + \%{js:before-next-token} + + + + + + + + + + + + + + @@ -105,7 +141,7 @@ - + @@ -187,6 +223,31 @@ + + + + \%{typescript:type-keyword} + \%{js:before-next-token} + + + + + + + + + + + + + + + @@ -219,5 +280,13 @@ + + + + + + + + diff --git a/data/language-specs/typescript-js-statements.lang b/data/language-specs/typescript-js-statements.lang index fe21bcecb..1559be19b 100644 --- a/data/language-specs/typescript-js-statements.lang +++ b/data/language-specs/typescript-js-statements.lang @@ -471,10 +471,6 @@ type Container = { value: T }; --> - - \%{js:keyword-start} type \%{js:keyword-end} - - = \%{js:before-next-token} @@ -498,35 +494,24 @@ - - - - - - - - - \%{_type-alias-declaration-keyword} + \%{typescript:type-keyword} \%{js:statement-end} - - - - - - \%{_type-alias-declaration-keyword} - \%{js:statement-end} - - - - + + + + + + + + - + diff --git a/data/language-specs/typescript.lang b/data/language-specs/typescript.lang index 0adfa7072..1c6c3471c 100644 --- a/data/language-specs/typescript.lang +++ b/data/language-specs/typescript.lang @@ -122,6 +122,10 @@ \%{js:keyword-start} class \%{js:keyword-end} + + \%{js:keyword-start} type \%{js:keyword-end} + + \%{js:before-next-token} \%{js:before-next-token} @@ -798,6 +802,7 @@ + diff --git a/tests/syntax-highlighting/file.ts b/tests/syntax-highlighting/file.ts index 868e93621..8f30877b0 100644 --- a/tests/syntax-highlighting/file.ts +++ b/tests/syntax-highlighting/file.ts @@ -569,6 +569,13 @@ import shortname = Long.Namespace.Name; // Import require import mod = require("module"); +// Type-only imports and exports +import type T from './mod'; +import type { A, B } from './mod'; +import type * as Types from './mod'; +export type { T }; +export type { T } from './mod'; + /* Variable declaration */ diff --git a/tests/syntax-highlighting/file.tsx b/tests/syntax-highlighting/file.tsx index 353c177c6..fd13e4dca 100644 --- a/tests/syntax-highlighting/file.tsx +++ b/tests/syntax-highlighting/file.tsx @@ -677,6 +677,13 @@ import shortname = Long.Namespace.Name; // Import require import mod = require("module"); +// Type-only imports and exports +import type T from './mod'; +import type { A, B } from './mod'; +import type * as Types from './mod'; +export type { T }; +export type { T } from './mod'; + /* Variable declaration */