feat(typescript): support TSOptionalType and TSRestType (#4757)
Ref: Microsoft/TypeScript#24897master
parent
e10c31a333
commit
50d242d085
|
@ -56,7 +56,7 @@
|
|||
"resolve": "1.5.0",
|
||||
"semver": "5.4.1",
|
||||
"string-width": "2.1.1",
|
||||
"typescript": "3.0.0-dev.20180602",
|
||||
"typescript": "3.0.0-dev.20180626",
|
||||
"typescript-eslint-parser": "eslint/typescript-eslint-parser#42f29a1db5c51262fd9ed2d6105015da8925ba2d",
|
||||
"unicode-regex": "1.0.1",
|
||||
"unified": "6.1.6",
|
||||
|
|
|
@ -2490,6 +2490,10 @@ function printPathNoParens(path, options, print, args) {
|
|||
|
||||
return group(concat(parts));
|
||||
}
|
||||
case "TSRestType":
|
||||
return concat(["...", path.call(print, "typeAnnotation")]);
|
||||
case "TSOptionalType":
|
||||
return concat([path.call(print, "typeAnnotation"), "?"]);
|
||||
case "FunctionTypeParam":
|
||||
return concat([
|
||||
path.call(print, "name"),
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`simple.ts 1`] = `
|
||||
type X = [number, string?];
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
type X = [number, string?];
|
||||
|
||||
`;
|
|
@ -0,0 +1 @@
|
|||
run_spec(__dirname, ["typescript"]);
|
|
@ -0,0 +1 @@
|
|||
type X = [number, string?];
|
|
@ -0,0 +1,8 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`simple.ts 1`] = `
|
||||
type X = [...number[]];
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
type X = [...number[]];
|
||||
|
||||
`;
|
|
@ -0,0 +1 @@
|
|||
run_spec(__dirname, ["typescript"]);
|
|
@ -0,0 +1 @@
|
|||
type X = [...number[]];
|
|
@ -5747,9 +5747,9 @@ typescript-eslint-parser@eslint/typescript-eslint-parser#42f29a1db5c51262fd9ed2d
|
|||
lodash.unescape "4.0.1"
|
||||
semver "5.5.0"
|
||||
|
||||
typescript@3.0.0-dev.20180602:
|
||||
version "3.0.0-dev.20180602"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.0.0-dev.20180602.tgz#ca368c199b4e3cbfd25b82ecece3f2b13349c893"
|
||||
typescript@3.0.0-dev.20180626:
|
||||
version "3.0.0-dev.20180626"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.0.0-dev.20180626.tgz#fb6be91cfc8e8757d551e83af208d0083be61499"
|
||||
|
||||
ua-parser-js@^0.7.9:
|
||||
version "0.7.17"
|
||||
|
|
Loading…
Reference in New Issue