fix(typescript): no invalid output for ImportType in TypeReference (#4939)
parent
a3ab95abe9
commit
308863e061
|
@ -57,8 +57,8 @@
|
|||
"resolve": "1.5.0",
|
||||
"semver": "5.4.1",
|
||||
"string-width": "2.1.1",
|
||||
"typescript": "3.0.0-dev.20180626",
|
||||
"typescript-eslint-parser": "17.0.0",
|
||||
"typescript": "3.0.1",
|
||||
"typescript-eslint-parser": "18.0.0",
|
||||
"unicode-regex": "1.0.1",
|
||||
"unified": "6.1.6",
|
||||
"yaml": "ikatyang/yaml#a765c1ee16d6b8a5e715564645f2b85f7e04828b",
|
||||
|
@ -117,7 +117,7 @@
|
|||
"perf-benchmark": "yarn && yarn build && cross-env NODE_ENV=production node ./dist/bin-prettier.js --debug-benchmark --loglevel debug ${PERF_FILE:-./index.js} > /dev/null",
|
||||
"lint": "cross-env EFF_NO_LINK_RULES=true eslint . --format node_modules/eslint-friendly-formatter",
|
||||
"lint-docs": "prettylint {.,docs,website,website/blog}/*.md",
|
||||
"build": "node ./scripts/build/build.js",
|
||||
"build": "node --max-old-space-size=2048 ./scripts/build/build.js",
|
||||
"build-docs": "node ./scripts/build-docs.js",
|
||||
"check-deps": "node ./scripts/check-deps.js"
|
||||
}
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
const path = require("path");
|
||||
const shell = require("shelljs");
|
||||
|
||||
shell.config.fatal = true;
|
||||
|
||||
const rootDir = path.join(__dirname, "..");
|
||||
const docs = path.join(rootDir, "website/static/lib");
|
||||
|
||||
|
@ -22,7 +24,7 @@ if (isPullRequest) {
|
|||
const pkg = require("../package.json");
|
||||
pkg.version = `999.999.999-pr.${process.env.REVIEW_ID}`;
|
||||
pipe(JSON.stringify(pkg, null, 2)).to("package.json");
|
||||
shell.exec("node scripts/build/build.js");
|
||||
shell.exec("yarn build");
|
||||
}
|
||||
shell.exec(`cp ${prettierPath}/standalone.js ${docs}/`);
|
||||
shell.exec(`cp ${prettierPath}/parser-*.js ${docs}/`);
|
||||
|
|
|
@ -2923,11 +2923,11 @@ function printPathNoParens(path, options, print, args) {
|
|||
return concat([path.call(print, "expression"), "!"]);
|
||||
case "TSThisType":
|
||||
return "this";
|
||||
case "TSLastTypeNode": // TSImportType
|
||||
case "TSImportType":
|
||||
return concat([
|
||||
!n.isTypeOf ? "" : "typeof ",
|
||||
"import(",
|
||||
path.call(print, "argument"),
|
||||
path.call(print, "parameter"),
|
||||
")",
|
||||
!n.qualifier ? "" : concat([".", path.call(print, "qualifier")]),
|
||||
printTypeParameters(path, options, print, "typeParameters")
|
||||
|
|
|
@ -14,6 +14,8 @@ export let shim: typeof import("./foo2") = {
|
|||
export interface Foo {
|
||||
bar: import('immutable').Map<string, int>;
|
||||
}
|
||||
|
||||
type X = A<import("B").C<any>>;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// ref: https://github.com/Microsoft/TypeScript/pull/22592
|
||||
|
||||
|
@ -29,6 +31,8 @@ export interface Foo {
|
|||
bar: import("immutable").Map<string, int>;
|
||||
}
|
||||
|
||||
type X = A<import("B").C<any>>;
|
||||
|
||||
`;
|
||||
|
||||
exports[`import-type.ts - typescript-verify 2`] = `
|
||||
|
@ -45,6 +49,8 @@ export let shim: typeof import("./foo2") = {
|
|||
export interface Foo {
|
||||
bar: import('immutable').Map<string, int>;
|
||||
}
|
||||
|
||||
type X = A<import("B").C<any>>;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// ref: https://github.com/Microsoft/TypeScript/pull/22592
|
||||
|
||||
|
@ -60,4 +66,6 @@ export interface Foo {
|
|||
bar: import('immutable').Map<string, int>;
|
||||
}
|
||||
|
||||
type X = A<import('B').C<any>>;
|
||||
|
||||
`;
|
||||
|
|
|
@ -11,3 +11,5 @@ export let shim: typeof import("./foo2") = {
|
|||
export interface Foo {
|
||||
bar: import('immutable').Map<string, int>;
|
||||
}
|
||||
|
||||
type X = A<import("B").C<any>>;
|
||||
|
|
12
yarn.lock
12
yarn.lock
|
@ -5680,16 +5680,16 @@ typedarray@^0.0.6:
|
|||
version "0.0.6"
|
||||
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
|
||||
|
||||
typescript-eslint-parser@17.0.0:
|
||||
version "17.0.0"
|
||||
resolved "https://registry.yarnpkg.com/typescript-eslint-parser/-/typescript-eslint-parser-17.0.0.tgz#0e2b5c0d15f2e2cfdf43dd024c96b10d016bef26"
|
||||
typescript-eslint-parser@18.0.0:
|
||||
version "18.0.0"
|
||||
resolved "https://registry.yarnpkg.com/typescript-eslint-parser/-/typescript-eslint-parser-18.0.0.tgz#3e5055a44980d69e4154350fc5d8b1ab4e2332a8"
|
||||
dependencies:
|
||||
lodash.unescape "4.0.1"
|
||||
semver "5.5.0"
|
||||
|
||||
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"
|
||||
typescript@3.0.1:
|
||||
version "3.0.1"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.0.1.tgz#43738f29585d3a87575520a4b93ab6026ef11fdb"
|
||||
|
||||
ua-parser-js@^0.7.9:
|
||||
version "0.7.17"
|
||||
|
|
Loading…
Reference in New Issue