diff --git a/dprint.config.js b/dprint.config.js index c9f144ef5..be636854f 100644 --- a/dprint.config.js +++ b/dprint.config.js @@ -9,6 +9,7 @@ module.exports.config = { plugins: [ new TypeScriptPlugin({ useBraces: "preferNone", + singleBodyPosition: "nextLine", "tryStatement.nextControlFlowPosition": "sameLine" }), new JsoncPlugin({ diff --git a/package.json b/package.json index 4e3e0e4fc..88e8b9aa7 100644 --- a/package.json +++ b/package.json @@ -79,7 +79,7 @@ "typescript": "^3.0.1" }, "devDependencies": { - "@types/chai": "^4.1.7", + "@types/chai": "^4.2.0", "@types/diff": "^4.0.2", "@types/fs-extra": "^8.0.0", "@types/glob-parent": "^3.1.1", @@ -87,20 +87,20 @@ "@types/is-negated-glob": "^1.0.0", "@types/mocha": "^5.2.7", "@types/multimatch": "^4.0.0", - "@types/node": "^12.6.9", + "@types/node": "^12.7.3", "@types/ts-nameof": "^3.2.0", "chai": "^4.2.0", "chalk": "^2.4.2", "conditional-type-checks": "^1.0.1", - "coveralls": "^3.0.5", + "coveralls": "^3.0.6", "cross-env": "^5.2.0", "diff": "^4.0.1", - "dprint": "^0.4.1", - "dprint-plugin-jsonc": "^0.1.1", - "dprint-plugin-typescript": "^0.1.1", + "dprint": "^0.6.1", + "dprint-plugin-jsonc": "^0.2.1", + "dprint-plugin-typescript": "^0.5.0", "mocha": "6.2.0", "nyc": "14.1.1", - "rimraf": "^2.6.3", + "rimraf": "^3.0.0", "shelljs": "^0.8.3", "shx": "^0.3.2", "source-map-support": "^0.5.13", @@ -108,7 +108,7 @@ "ts-nameof": "^3.2.0", "ts-node": "8.3.0", "ttypescript": "1.5.7", - "typescript": "3.5.3", + "typescript": "3.6.2", "typescript-3.0.1": "npm:typescript@3.0.1", "typescript-3.0.3": "npm:typescript@3.0.3", "typescript-3.1.6": "npm:typescript@3.1.6", diff --git a/src/tests/compiler/ast/class/base/classLikeDeclarationBaseTests.ts b/src/tests/compiler/ast/class/base/classLikeDeclarationBaseTests.ts index 0bc4e4d6d..6ffbd1a7b 100644 --- a/src/tests/compiler/ast/class/base/classLikeDeclarationBaseTests.ts +++ b/src/tests/compiler/ast/class/base/classLikeDeclarationBaseTests.ts @@ -1051,8 +1051,7 @@ describe(nameof(ClassLikeDeclarationBase), () => { }); describe("has static methods", () => { - const { firstChild - } = getInfoFromText("class Identifier {\nstatic prop2: string;\nstatic method() {}\nprop: string;\nmethod1() {}\nmethod2() {}\n}\n"); + const { firstChild } = getInfoFromText("class Identifier {\nstatic prop2: string;\nstatic method() {}\nprop: string;\nmethod1() {}\nmethod2() {}\n}\n"); it("should get the right number of static methods", () => { expect(firstChild.getStaticMethods().length).to.equal(1); @@ -1109,8 +1108,7 @@ describe(nameof(ClassLikeDeclarationBase), () => { }); describe(nameof(d => d.getInstanceMembers), () => { - const { firstChild - } = getInfoFromText("class Identifier {\nconstructor(public p: string) {}\nstatic prop2: string;\nstatic method() {}\nprop: string;\n" + const { firstChild } = getInfoFromText("class Identifier {\nconstructor(public p: string) {}\nstatic prop2: string;\nstatic method() {}\nprop: string;\n" + "prop2: number;method1() {}\n}\n"); it("should get the right number of instance members", () => { expect(firstChild.getInstanceMembers().length).to.equal(4); @@ -1167,8 +1165,7 @@ describe(nameof(ClassLikeDeclarationBase), () => { }); describe(nameof(d => d.getStaticMembers), () => { - const { firstChild - } = getInfoFromText("class Identifier {\nconstructor(public p: string) {}\nstatic prop2: string;\nstatic method() {}\nprop: string;\n" + const { firstChild } = getInfoFromText("class Identifier {\nconstructor(public p: string) {}\nstatic prop2: string;\nstatic method() {}\nprop: string;\n" + "prop2: number;method1() {}\n}\n"); it("should get the right number of static members", () => { expect(firstChild.getStaticMembers().length).to.equal(2); diff --git a/src/tests/compiler/symbols/signatureTests.ts b/src/tests/compiler/symbols/signatureTests.ts index 4fdb56846..3694bc0a3 100644 --- a/src/tests/compiler/symbols/signatureTests.ts +++ b/src/tests/compiler/symbols/signatureTests.ts @@ -52,18 +52,13 @@ interface MyInterface { /** * Docs */ - /** - * Docs 2 - */ () => void; } let t: MyInterface; `); expect(signature.getDocumentationComments().map(c => ({ text: c.getText(), kind: c.getKind() }))).to.deep.equal([ - { text: "Docs", kind: "text" }, - { text: "\n", kind: "lineBreak" }, // not sure why the compiler returns this... - { text: "Docs 2", kind: "text" } + { text: "Docs", kind: "text" } ]); }); }); diff --git a/src/tests/compiler/type/typeTests.ts b/src/tests/compiler/type/typeTests.ts index 535fbcfc1..0caa5d6c2 100644 --- a/src/tests/compiler/type/typeTests.ts +++ b/src/tests/compiler/type/typeTests.ts @@ -24,7 +24,8 @@ describe(nameof(Type), () => { const text = ` enum EmptyEnum { } enum MyEnum { value, value2, value3 } -interface MyInterface {} +interface MyInterface { prop: string; } +interface MyInterface2 { prop2: string; } class MyClass {} let anonymousType: { str: string; }; @@ -41,7 +42,7 @@ let enumIncompleteUnionType: MyEnum.value | MyEnum.value2; let enumCompleteUnionType: MyEnum.value | MyEnum.value2 | MyEnum.value3; let enumLiteralType: MyEnum.value; let interfaceType: MyInterface; -let intersectionType: string & number; +let intersectionType: MyInterface & MyInterface2; let unionType: string | number; let objectType: { prop: string; }; let tupleType: [string]; @@ -96,8 +97,8 @@ let unknownType: unknown; it("should get them when they exist", () => { const firstType = typesByName["intersectionType"]; expect(firstType.getIntersectionTypes().length).to.equal(2); - expect(firstType.getIntersectionTypes()[0].getFlags()).to.equal(TypeFlags.String); - expect(firstType.getIntersectionTypes()[1].getFlags()).to.equal(TypeFlags.Number); + expect(firstType.getIntersectionTypes()[0].getText()).to.equal("MyInterface"); + expect(firstType.getIntersectionTypes()[1].getText()).to.equal("MyInterface2"); }); it("should not return anything for a union type", () => { diff --git a/yarn.lock b/yarn.lock index ed2ca49fc..946ab56f2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -164,9 +164,9 @@ lodash "^4.17.13" to-fast-properties "^2.0.0" -"@dprint/core@~0.2.0": - version "0.2.0" - resolved "https://registry.yarnpkg.com/@dprint/core/-/core-0.2.0.tgz#ee80cdb388796a8c18505fd3ca7bc9b36df5fc45" +"@dprint/core@~0.4.1": + version "0.4.1" + resolved "https://registry.yarnpkg.com/@dprint/core/-/core-0.4.1.tgz#97826de12bebc1ca35ba561c9ccb019d758ff133" "@dsherret/to-absolute-glob@^2.0.2": version "2.0.2" @@ -175,27 +175,27 @@ is-absolute "^1.0.0" is-negated-glob "^1.0.0" -"@nodelib/fs.scandir@2.1.1": - version "2.1.1" - resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.1.tgz#7fa8fed654939e1a39753d286b48b4836d00e0eb" +"@nodelib/fs.scandir@2.1.2": + version "2.1.2" + resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.2.tgz#1f981cd5b83e85cfdeb386fc693d4baab392fa54" dependencies: - "@nodelib/fs.stat" "2.0.1" + "@nodelib/fs.stat" "2.0.2" run-parallel "^1.1.9" -"@nodelib/fs.stat@2.0.1", "@nodelib/fs.stat@^2.0.1": - version "2.0.1" - resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-2.0.1.tgz#814f71b1167390cfcb6a6b3d9cdeb0951a192c14" +"@nodelib/fs.stat@2.0.2", "@nodelib/fs.stat@^2.0.1": + version "2.0.2" + resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-2.0.2.tgz#2762aea8fe78ea256860182dcb52d61ee4b8fda6" "@nodelib/fs.walk@^1.2.1": - version "1.2.2" - resolved "https://registry.yarnpkg.com/@nodelib/fs.walk/-/fs.walk-1.2.2.tgz#6a6450c5e17012abd81450eb74949a4d970d2807" + version "1.2.3" + resolved "https://registry.yarnpkg.com/@nodelib/fs.walk/-/fs.walk-1.2.3.tgz#a555dc256acaf00c62b0db29529028dd4d4cb141" dependencies: - "@nodelib/fs.scandir" "2.1.1" + "@nodelib/fs.scandir" "2.1.2" fastq "^1.6.0" -"@types/chai@^4.1.7": - version "4.1.7" - resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.1.7.tgz#1b8e33b61a8c09cbe1f85133071baa0dbf9fa71a" +"@types/chai@^4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.2.0.tgz#2478260021408dec32c123a7cad3414beb811a07" "@types/diff@^4.0.2": version "4.0.2" @@ -247,9 +247,9 @@ dependencies: multimatch "*" -"@types/node@*", "@types/node@^12.6.9": - version "12.6.9" - resolved "https://registry.yarnpkg.com/@types/node/-/node-12.6.9.tgz#ffeee23afdc19ab16e979338e7b536fdebbbaeaf" +"@types/node@*", "@types/node@^12.7.3": + version "12.7.3" + resolved "https://registry.yarnpkg.com/@types/node/-/node-12.7.3.tgz#27b3f40addaf2f580459fdb405222685542f907a" "@types/ts-nameof@^3.2.0": version "3.2.0" @@ -481,9 +481,9 @@ core-util-is@1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" -coveralls@^3.0.5: - version "3.0.5" - resolved "https://registry.yarnpkg.com/coveralls/-/coveralls-3.0.5.tgz#28d7274c6c9827aa85537eab82d66e7e62d0d527" +coveralls@^3.0.6: + version "3.0.6" + resolved "https://registry.yarnpkg.com/coveralls/-/coveralls-3.0.6.tgz#5c63b2759b6781118e7439bd870ba5e9ee428b25" dependencies: growl "~> 1.10.0" js-yaml "^3.13.1" @@ -503,11 +503,10 @@ cp-file@^6.2.0: safe-buffer "^5.0.1" cross-env@^5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-5.2.0.tgz#6ecd4c015d5773e614039ee529076669b9d126f2" + version "5.2.1" + resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-5.2.1.tgz#b2c76c1ca7add66dc874d11798466094f551b34d" dependencies: cross-spawn "^6.0.5" - is-windows "^1.0.0" cross-spawn@^4: version "4.0.2" @@ -584,25 +583,25 @@ dir-glob@^3.0.1: dependencies: path-type "^4.0.0" -dprint-plugin-jsonc@^0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/dprint-plugin-jsonc/-/dprint-plugin-jsonc-0.1.1.tgz#177f05f03e94408ce96562386fcc1bf60765b44e" +dprint-plugin-jsonc@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/dprint-plugin-jsonc/-/dprint-plugin-jsonc-0.2.1.tgz#61244fc2fb4a81422d121d8d45d4ae4ac3c84ea0" dependencies: jsonc-parser "^2.1.0" -dprint-plugin-typescript@^0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/dprint-plugin-typescript/-/dprint-plugin-typescript-0.1.1.tgz#13b968403cd2ba930d49e6b9f2df762c38e75c09" +dprint-plugin-typescript@^0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/dprint-plugin-typescript/-/dprint-plugin-typescript-0.5.0.tgz#0fe2e6a7aace265d92d01ea872de79f679a6f0e3" dependencies: "@babel/core" "^7.5.5" "@babel/parser" "^7.5.5" "@babel/preset-typescript" "^7.3.3" -dprint@^0.4.1: - version "0.4.1" - resolved "https://registry.yarnpkg.com/dprint/-/dprint-0.4.1.tgz#a48ebdce1ae3d84b3727d702736ae1be3eebce29" +dprint@^0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/dprint/-/dprint-0.6.1.tgz#46daabbc5827e9ebaffdb9adf75034f1be4e5821" dependencies: - "@dprint/core" "~0.2.0" + "@dprint/core" "~0.4.1" globby "^10.0.1" minimist "^1.2.0" @@ -848,8 +847,8 @@ globby@*, globby@^10.0.1: slash "^3.0.0" graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0: - version "4.2.1" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.1.tgz#1c1f0c364882c868f5bff6512146328336a11b1d" + version "4.2.2" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.2.tgz#6f0952605d0140c1cfdb138ed005775b92d67b02" growl@1.10.5, "growl@~> 1.10.0": version "1.10.5" @@ -901,8 +900,8 @@ he@1.2.0: resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" hosted-git-info@^2.1.4: - version "2.7.1" - resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.7.1.tgz#97f236977bd6e125408930ff6de3eec6281ec047" + version "2.8.4" + resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.4.tgz#44119abaf4bc64692a16ace34700fed9c03e2546" http-signature@~1.2.0: version "1.2.0" @@ -913,8 +912,8 @@ http-signature@~1.2.0: sshpk "^1.7.0" ignore@^5.1.1: - version "5.1.2" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.2.tgz#e28e584d43ad7e92f96995019cc43b9e1ac49558" + version "5.1.4" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.4.tgz#84b7b3dbe64552b6ef0eca99f6743dbec6d97adf" imurmurhash@^0.1.4: version "0.1.4" @@ -1022,7 +1021,7 @@ is-unc-path@^1.0.0: dependencies: unc-path-regex "^0.1.2" -is-windows@^1.0.0, is-windows@^1.0.1: +is-windows@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" @@ -1122,8 +1121,8 @@ json5@^2.1.0: minimist "^1.2.0" jsonc-parser@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-2.1.0.tgz#eb0d0c7a3c33048524ce3574c57c7278fb2f1bf3" + version "2.1.1" + resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-2.1.1.tgz#83dc3d7a6e7186346b889b1280eefa04446c6d3e" jsonfile@^4.0.0: version "4.0.0" @@ -1447,8 +1446,8 @@ p-is-promise@^2.0.0: resolved "https://registry.yarnpkg.com/p-is-promise/-/p-is-promise-2.1.0.tgz#918cebaea248a62cf7ffab8e3bca8c5f882fc42e" p-limit@^2.0.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.2.0.tgz#417c9941e6027a9abcba5092dd2904e255b5fbc2" + version "2.2.1" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.2.1.tgz#aa07a788cc3151c939b5131f63570f0dd2009537" dependencies: p-try "^2.0.0" @@ -1636,8 +1635,14 @@ reusify@^1.0.0: resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" rimraf@^2.6.2, rimraf@^2.6.3: - version "2.6.3" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab" + version "2.7.1" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec" + dependencies: + glob "^7.1.3" + +rimraf@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.0.tgz#614176d4b3010b75e5c390eb0ee96f6dc0cebb9b" dependencies: glob "^7.1.3" @@ -1658,8 +1663,8 @@ safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0: resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" "semver@2 || 3 || 4 || 5", semver@^5.4.1, semver@^5.5.0, semver@^5.6.0, semver@^5.7.0: - version "5.7.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.0.tgz#790a7cf6fea5459bac96110b29b60412dc8ff96b" + version "5.7.1" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" semver@^6.0.0: version "6.3.0" @@ -1719,8 +1724,8 @@ source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1: resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" spawn-wrap@^1.4.2: - version "1.4.2" - resolved "https://registry.yarnpkg.com/spawn-wrap/-/spawn-wrap-1.4.2.tgz#cff58e73a8224617b6561abdc32586ea0c82248c" + version "1.4.3" + resolved "https://registry.yarnpkg.com/spawn-wrap/-/spawn-wrap-1.4.3.tgz#81b7670e170cca247d80bf5faf0cfb713bdcf848" dependencies: foreground-child "^1.5.6" mkdirp "^0.5.0" @@ -1944,8 +1949,8 @@ type-detect@^4.0.0, type-detect@^4.0.5: resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.4.5.tgz#2d2618d10bb566572b8d7aad5180d84257d70a99" typescript@^3.0.1: - version "3.5.3" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.5.3.tgz#c830f657f93f1ea846819e929092f5fe5983e977" + version "3.6.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.6.2.tgz#105b0f1934119dde543ac8eb71af3a91009efe54" uglify-js@^3.1.4: version "3.6.0" @@ -1969,8 +1974,8 @@ uri-js@^4.2.2: punycode "^2.1.0" uuid@^3.3.2: - version "3.3.2" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.2.tgz#1b4af4955eb3077c501c23872fc6513811587131" + version "3.3.3" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.3.tgz#4568f0216e78760ee1dbf3a4d2cf53e224112866" validate-npm-package-license@^3.0.1: version "3.0.4"