Skip to content

Commit

Permalink
TypeScript: Removed duplicate keywords
Browse files Browse the repository at this point in the history
  • Loading branch information
RunDevelopment committed Oct 5, 2021
1 parent a394a14 commit 876223b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion components/prism-typescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

// The keywords TypeScript adds to JavaScript
Prism.languages.typescript.keyword.push(
/\b(?:abstract|as|declare|implements|is|keyof|readonly|require)\b/,
/\b(?:abstract|declare|is|keyof|readonly|require)\b/,
// keywords that have to be followed by an identifier
/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,
// This is for `import type *, {}`
Expand Down
2 changes: 1 addition & 1 deletion components/prism-typescript.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion tests/languages/typescript/keyword_feature.test
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ namespace foo;
type foo;

import type { Component } from "react";
import type *, {}

----------------------------------------------------

Expand Down Expand Up @@ -269,7 +270,14 @@ import type { Component } from "react";
["punctuation", "}"],
["keyword", "from"],
["string", "\"react\""],
["punctuation", ";"]
["punctuation", ";"],

["keyword", "import"],
["keyword", "type"],
["operator", "*"],
["punctuation", ","],
["punctuation", "{"],
["punctuation", "}"]
]

----------------------------------------------------
Expand Down

0 comments on commit 876223b

Please sign in to comment.