fix(typescript): support `unique symbol` (#3967)

* test(typescript): add failing test

* chore(deps): update typescript-eslint-parser to v13.0.0

* fix(typescript): support `unique symbol`
master
Ika 2018-02-14 01:03:53 +08:00 committed by GitHub
parent 791e5cd0ae
commit 4a4bd2faed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 23 additions and 6 deletions

View File

@ -56,7 +56,7 @@
"string-width": "2.1.1",
"html-tag-names": "1.1.1",
"typescript": "2.7.0-insiders.20171214",
"typescript-eslint-parser": "11.0.0",
"typescript-eslint-parser": "13.0.0",
"unicode-regex": "1.0.1",
"unified": "6.1.6"
},

View File

@ -2665,7 +2665,7 @@ function printPathNoParens(path, options, print, args) {
return concat(parts);
}
case "TSTypeOperator":
return concat(["keyof ", path.call(print, "typeAnnotation")]);
return concat([n.operator, " ", path.call(print, "typeAnnotation")]);
case "TSMappedType":
return group(
concat([

View File

@ -0,0 +1,10 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`unique-symbol.ts 1`] = `
type A = unique symbol;
type B = keyof something;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
type A = unique symbol;
type B = keyof something;
`;

View File

@ -0,0 +1 @@
run_spec(__dirname, ["typescript"]);

View File

@ -0,0 +1,2 @@
type A = unique symbol;
type B = keyof something;

View File

@ -4132,6 +4132,10 @@ sax@^1.2.1:
version "5.4.1"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.4.1.tgz#e059c09d8571f0540823733433505d3a2f00b18e"
semver@5.5.0:
version "5.5.0"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab"
serviceworker-cache-polyfill@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/serviceworker-cache-polyfill/-/serviceworker-cache-polyfill-4.0.0.tgz#de19ee73bef21ab3c0740a37b33db62464babdeb"
@ -4575,12 +4579,12 @@ typedarray@^0.0.6:
version "0.0.6"
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
typescript-eslint-parser@11.0.0:
version "11.0.0"
resolved "https://registry.yarnpkg.com/typescript-eslint-parser/-/typescript-eslint-parser-11.0.0.tgz#37dba6a0130dd307504aa4b4b21b0d3dc7d4e9f2"
typescript-eslint-parser@13.0.0:
version "13.0.0"
resolved "https://registry.yarnpkg.com/typescript-eslint-parser/-/typescript-eslint-parser-13.0.0.tgz#57f9be603d0fad7c26da76c2be67c0779d23362c"
dependencies:
lodash.unescape "4.0.1"
semver "5.4.1"
semver "5.5.0"
typescript@2.7.0-insiders.20171214:
version "2.7.0-insiders.20171214"