feat(typescript): support TSMinusToken

This commit is contained in:
Wang Zhongliang committed 2018-03-16 10:46:12 +08:00
1 parent 0c09e150ba
commit 67277f7477
5 files changed
+25 -6

No files matched your search

+1 -1
View File
@@ -55,7 +55,7 @@
"resolve": "1.5.0",
"semver": "5.4.1",
"string-width": "2.1.1",
"typescript": "2.8.0-dev.20180222",
"typescript": "2.8.0-rc",
"typescript-eslint-parser": "14.0.0",
"unicode-regex": "1.0.1",
"unified": "6.1.6"
+9 -2
View File
@@ -2722,13 +2722,20 @@ function printPathNoParens(path, options, print, args) {
concat([
options.bracketSpacing ? line : softline,
n.readonlyToken
? concat([path.call(print, "readonlyToken"), " "])
? concat([
n.readonlyToken.type === "TSMinusToken"
? "-readonly"
: "readonly",
" "
])
: "",
printTypeScriptModifiers(path, options, print),
"[",
path.call(print, "typeParameter"),
"]",
n.questionToken ? "?" : "",
n.questionToken
? n.questionToken.type === "TSMinusToken" ? "-?" : "?"
: "",
": ",
path.call(print, "typeAnnotation")
])
@@ -1,5 +1,14 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`minustoken.ts 1`] = `
type MutableAndRequired<T> = {
-readonly [P in keyof T]-?: T[P]
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
type MutableAndRequired<T> = { -readonly [P in keyof T]-?: T[P] };
`;
exports[`question.ts 1`] = `
var x: {
[A in keyof B]?: any;
@@ -0,0 +1,3 @@
type MutableAndRequired<T> = {
-readonly [P in keyof T]-?: T[P]
}
+3 -3
View File
@@ -4784,9 +4784,9 @@ typescript-eslint-parser@14.0.0:
lodash.unescape "4.0.1"
semver "5.5.0"
typescript@2.8.0-dev.20180222:
version "2.8.0-dev.20180222"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.8.0-dev.20180222.tgz#50ee5fd5c76f2c9817e949803f946d74a559fc01"
typescript@2.8.0-rc:
version "2.8.0-rc"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.8.0-rc.tgz#a0256b7d1d39fb7493ba0403f55e95d31e8bc374"
ua-parser-js@^0.7.9:
version "0.7.17"