Skip to content
Snippets Groups Projects
Commit 653f64cc authored by Marijn Haverbeke's avatar Marijn Haverbeke
Browse files

[javascript mode] Recognize TypeScript-style optional arguments

Closes #4212
parent 45f97d2f
No related branches found
No related tags found
No related merge requests found
......@@ -521,8 +521,11 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
if (type == "}") return cont();
return pass(statement, block);
}
function maybetype(type) {
if (isTS && type == ":") return cont(typeexpr);
function maybetype(type, value) {
if (isTS) {
if (type == ":") return cont(typeexpr);
if (value == "?") return cont(maybetype);
}
}
function maybedefault(_, value) {
if (value == "=") return cont(expressionNoComma);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment