Skip to content
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

Add support for nullish coalescing operator to TypeScript lexer #1529

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/rouge/lexers/typescript/common.rb
Expand Up @@ -33,6 +33,7 @@ def builtins
def self.extended(base)
base.prepend :root do
rule %r/[?][.]/, base::Punctuation
rule %r/[?]{2}/, base::Operator
end

base.prepend :statement do
Expand Down
4 changes: 4 additions & 0 deletions spec/visual/samples/typescript
Expand Up @@ -203,3 +203,7 @@ declare module "foo" {
const x = `Hello world ${a.b}`;
const y = `Hello world ${a?.b}`;
const z = `Hello world`;

// Nullish coalescing in template strings
const content = `Value is ${value ?? 'not set'}`;
const description = "Highlighting is not broken now";