From 432008c8dbda7ea8c6b9115f0302843593f54911 Mon Sep 17 00:00:00 2001 From: Gerrit Birkeland Date: Sat, 5 Jun 2021 10:04:27 -0600 Subject: [PATCH] feat: Support for TypeScript 4.3 --- .prettierignore | 4 - examples/basic/src/classes.ts | 6 +- examples/basic/src/mixin.ts | 6 +- package-lock.json | 272 ++++++++++-------- package.json | 22 +- src/lib/converter/context.ts | 3 +- src/lib/converter/factories/comment.ts | 79 +++-- src/lib/converter/plugins/CommentPlugin.ts | 18 +- src/lib/converter/symbols.ts | 23 +- src/lib/utils/loggers.ts | 10 +- src/lib/utils/options/options.ts | 24 +- src/test/converter/class/class.ts | 4 +- .../class/specs-with-lump-categories.json | 14 +- src/test/converter/class/specs.json | 14 +- src/test/converter/comment/comment2.ts | 2 - src/test/converter/comment/specs.json | 3 +- src/test/converter/js/specs.json | 16 +- src/test/converter/mixin/mixin.ts | 6 +- src/test/converter/mixin/specs.json | 186 ++---------- src/test/converter/variables/specs.json | 2 +- src/test/converter2.test.ts | 3 +- src/test/converter2/issues/gh1580.ts | 2 +- .../renderer/specs/classes/mixin.base.html | 4 +- .../classes/mixin.someclasswithmixin.html | 10 +- .../specs/interfaces/mixin.mixin1type.html | 4 +- ...ixin.mixin2.html => mixin.mixin2type.html} | 44 +-- src/test/renderer/specs/modules/mixin.html | 10 +- src/test/utils/options/options.test.ts | 6 - 28 files changed, 326 insertions(+), 471 deletions(-) rename src/test/renderer/specs/interfaces/{mixin.mixin2.html => mixin.mixin2type.html} (77%) diff --git a/.prettierignore b/.prettierignore index 3f8c6bc7c..9b4e1ef60 100644 --- a/.prettierignore +++ b/.prettierignore @@ -5,7 +5,3 @@ dist package-lock.json src/test/**/specs*.json src/test/renderer/specs - -# Temporarily ignored until Prettier 2.3 -examples/basic/src/classes.ts -src/test/converter/class/class.ts diff --git a/examples/basic/src/classes.ts b/examples/basic/src/classes.ts index d0e697a5e..a6a3bf93c 100644 --- a/examples/basic/src/classes.ts +++ b/examples/basic/src/classes.ts @@ -208,7 +208,7 @@ class InternalClass { * from BaseClass. */ export class SubClassA extends BaseClass implements PrintNameInterface { - public name: string; + public declare name: string; /** * This is a simple interface function. @@ -269,7 +269,7 @@ export class SubClassA extends BaseClass implements PrintNameInterface { * The constructor of the original class should be overwritten. */ export class SubClassB extends BaseClass { - public name: string; + public declare name: string; constructor(name: string) { super(name); @@ -323,4 +323,4 @@ export class GenericClass { export class NonGenericClass extends GenericClass {} // TS 4.2 -export type AbstractMe = abstract new () => NonGenericClass +export type AbstractMe = abstract new () => NonGenericClass; diff --git a/examples/basic/src/mixin.ts b/examples/basic/src/mixin.ts index f338de8ff..b4537770b 100644 --- a/examples/basic/src/mixin.ts +++ b/examples/basic/src/mixin.ts @@ -56,15 +56,15 @@ export const Mixin2 = >(base: T) => class Mixin2 extends base { property2 = "init"; - method2(arg: Mixin2): Mixin2[] { - return [arg, this]; + method2(arg: Mixin2Type): Mixin2Type { + return arg; } }; /** * The "instance type" of the Mixin2 using the interface notation (supports recursive type definition) */ -export interface Mixin2 extends Mixin {} +export interface Mixin2Type extends Mixin {} /** * The "mixin function" of the Mixin3 diff --git a/package-lock.json b/package-lock.json index 65e29f6a1..e7f2a56a2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -345,15 +345,15 @@ } }, "@eslint/eslintrc": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.0.tgz", - "integrity": "sha512-2ZPCc+uNbjV5ERJr+aKSPRwZgKd2z11x0EgLvb1PURmUrn9QNRXFqje0Ldq454PfAVyaJYyrDvvIKSFP4NnBog==", + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.2.tgz", + "integrity": "sha512-8nmGq/4ycLpIwzvhI4tNDmQztZ8sp+hI7cyG8i1nQDhkAbRzHpXPidRAHlNvCZQpJTKw5ItIpMw9RSToGF00mg==", "dev": true, "requires": { "ajv": "^6.12.4", "debug": "^4.1.1", "espree": "^7.3.0", - "globals": "^12.1.0", + "globals": "^13.9.0", "ignore": "^4.0.6", "import-fresh": "^3.2.1", "js-yaml": "^3.13.1", @@ -362,12 +362,12 @@ }, "dependencies": { "globals": { - "version": "12.4.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-12.4.0.tgz", - "integrity": "sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg==", + "version": "13.9.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.9.0.tgz", + "integrity": "sha512-74/FduwI/JaIrr1H8e71UbDE+5x7pIPs1C2rrwC52SszOo043CsWOZEMW7o2Y58xwm9b+0RBKDxY5n2sUpEFxA==", "dev": true, "requires": { - "type-fest": "^0.8.1" + "type-fest": "^0.20.2" } }, "ignore": { @@ -375,6 +375,12 @@ "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", "dev": true + }, + "type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true } } }, @@ -398,28 +404,28 @@ "dev": true }, "@nodelib/fs.scandir": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.4.tgz", - "integrity": "sha512-33g3pMJk3bg5nXbL/+CY6I2eJDzZAni49PfJnL5fghPTggPvBd/pFNSgJsdAgWptuFu7qq/ERvOYFlhvsLTCKA==", + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", "dev": true, "requires": { - "@nodelib/fs.stat": "2.0.4", + "@nodelib/fs.stat": "2.0.5", "run-parallel": "^1.1.9" } }, "@nodelib/fs.stat": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.4.tgz", - "integrity": "sha512-IYlHJA0clt2+Vg7bccq+TzRdJvv19c2INqBSsoOLp1je7xjtr7J26+WXR72MCdvU9q1qTzIWDfhMf+DRvQJK4Q==", + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", "dev": true }, "@nodelib/fs.walk": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.6.tgz", - "integrity": "sha512-8Broas6vTtW4GIXTAHDoE32hnN2M5ykgCpWGbuXHQ15vEMqr23pB76e/GZcYsZCHALv50ktd24qhEyKr6wBtow==", + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.7.tgz", + "integrity": "sha512-BTIhocbPBSrRmHxOAJFtR18oLhxTtAFDAvL8hY1S3iU8k+E60W/YFs4jrixGzQjMpF4qPXxIQHcjVD9dz1C2QA==", "dev": true, "requires": { - "@nodelib/fs.scandir": "2.1.4", + "@nodelib/fs.scandir": "2.1.5", "fastq": "^1.6.0" } }, @@ -436,9 +442,9 @@ "dev": true }, "@types/lodash": { - "version": "4.14.168", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.168.tgz", - "integrity": "sha512-oVfRvqHV/V6D1yifJbVRU3TMp8OT6o6BG+U9MkwuJ3U8/CsDHvalRpsxBqivn71ztOFZBTfJMvETbqHiaNSj7Q==", + "version": "4.14.170", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.170.tgz", + "integrity": "sha512-bpcvu/MKHHeYX+qeEN8GE7DIravODWdACVA1ctevD8CN24RhPZIKMn9ntfAsrvLfSX3cR5RrBKAbYm9bGs0A+Q==", "dev": true }, "@types/lunr": { @@ -448,9 +454,9 @@ "dev": true }, "@types/marked": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@types/marked/-/marked-2.0.2.tgz", - "integrity": "sha512-P4zanhCQKs4tiWPPBGpB7lHflgFCP9DFGNI5YtpW9MALKoy2qs9rHNWJ+z55cegD9uCfnmsKuaosq9FNvbxrOw==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@types/marked/-/marked-2.0.3.tgz", + "integrity": "sha512-lbhSN1rht/tQ+dSWxawCzGgTfxe9DB31iLgiT1ZVT5lshpam/nyOA1m3tKHRoNPctB2ukSL22JZI5Fr+WI/zYg==", "dev": true }, "@types/minimatch": { @@ -466,91 +472,91 @@ "dev": true }, "@types/node": { - "version": "15.0.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-15.0.1.tgz", - "integrity": "sha512-TMkXt0Ck1y0KKsGr9gJtWGjttxlZnnvDtphxUOSd0bfaR6Q1jle+sPvrzNR1urqYTWMinoKvjKfXUGsumaO1PA==", + "version": "15.12.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-15.12.1.tgz", + "integrity": "sha512-zyxJM8I1c9q5sRMtVF+zdd13Jt6RU4r4qfhTd7lQubyThvLfx6yYekWSQjGCGV2Tkecgxnlpl/DNlb6Hg+dmEw==", "dev": true }, "@typescript-eslint/eslint-plugin": { - "version": "4.22.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.22.0.tgz", - "integrity": "sha512-U8SP9VOs275iDXaL08Ln1Fa/wLXfj5aTr/1c0t0j6CdbOnxh+TruXu1p4I0NAvdPBQgoPjHsgKn28mOi0FzfoA==", + "version": "4.26.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.26.0.tgz", + "integrity": "sha512-yA7IWp+5Qqf+TLbd8b35ySFOFzUfL7i+4If50EqvjT6w35X8Lv0eBHb6rATeWmucks37w+zV+tWnOXI9JlG6Eg==", "dev": true, "requires": { - "@typescript-eslint/experimental-utils": "4.22.0", - "@typescript-eslint/scope-manager": "4.22.0", - "debug": "^4.1.1", + "@typescript-eslint/experimental-utils": "4.26.0", + "@typescript-eslint/scope-manager": "4.26.0", + "debug": "^4.3.1", "functional-red-black-tree": "^1.0.1", - "lodash": "^4.17.15", - "regexpp": "^3.0.0", - "semver": "^7.3.2", - "tsutils": "^3.17.1" + "lodash": "^4.17.21", + "regexpp": "^3.1.0", + "semver": "^7.3.5", + "tsutils": "^3.21.0" } }, "@typescript-eslint/experimental-utils": { - "version": "4.22.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.22.0.tgz", - "integrity": "sha512-xJXHHl6TuAxB5AWiVrGhvbGL8/hbiCQ8FiWwObO3r0fnvBdrbWEDy1hlvGQOAWc6qsCWuWMKdVWlLAEMpxnddg==", + "version": "4.26.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.26.0.tgz", + "integrity": "sha512-TH2FO2rdDm7AWfAVRB5RSlbUhWxGVuxPNzGT7W65zVfl8H/WeXTk1e69IrcEVsBslrQSTDKQSaJD89hwKrhdkw==", "dev": true, "requires": { - "@types/json-schema": "^7.0.3", - "@typescript-eslint/scope-manager": "4.22.0", - "@typescript-eslint/types": "4.22.0", - "@typescript-eslint/typescript-estree": "4.22.0", - "eslint-scope": "^5.0.0", - "eslint-utils": "^2.0.0" + "@types/json-schema": "^7.0.7", + "@typescript-eslint/scope-manager": "4.26.0", + "@typescript-eslint/types": "4.26.0", + "@typescript-eslint/typescript-estree": "4.26.0", + "eslint-scope": "^5.1.1", + "eslint-utils": "^3.0.0" } }, "@typescript-eslint/parser": { - "version": "4.22.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.22.0.tgz", - "integrity": "sha512-z/bGdBJJZJN76nvAY9DkJANYgK3nlRstRRi74WHm3jjgf2I8AglrSY+6l7ogxOmn55YJ6oKZCLLy+6PW70z15Q==", + "version": "4.26.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.26.0.tgz", + "integrity": "sha512-b4jekVJG9FfmjUfmM4VoOItQhPlnt6MPOBUL0AQbiTmm+SSpSdhHYlwayOm4IW9KLI/4/cRKtQCmDl1oE2OlPg==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "4.22.0", - "@typescript-eslint/types": "4.22.0", - "@typescript-eslint/typescript-estree": "4.22.0", - "debug": "^4.1.1" + "@typescript-eslint/scope-manager": "4.26.0", + "@typescript-eslint/types": "4.26.0", + "@typescript-eslint/typescript-estree": "4.26.0", + "debug": "^4.3.1" } }, "@typescript-eslint/scope-manager": { - "version": "4.22.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.22.0.tgz", - "integrity": "sha512-OcCO7LTdk6ukawUM40wo61WdeoA7NM/zaoq1/2cs13M7GyiF+T4rxuA4xM+6LeHWjWbss7hkGXjFDRcKD4O04Q==", + "version": "4.26.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.26.0.tgz", + "integrity": "sha512-G6xB6mMo4xVxwMt5lEsNTz3x4qGDt0NSGmTBNBPJxNsrTXJSm21c6raeYroS2OwQsOyIXqKZv266L/Gln1BWqg==", "dev": true, "requires": { - "@typescript-eslint/types": "4.22.0", - "@typescript-eslint/visitor-keys": "4.22.0" + "@typescript-eslint/types": "4.26.0", + "@typescript-eslint/visitor-keys": "4.26.0" } }, "@typescript-eslint/types": { - "version": "4.22.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.22.0.tgz", - "integrity": "sha512-sW/BiXmmyMqDPO2kpOhSy2Py5w6KvRRsKZnV0c4+0nr4GIcedJwXAq+RHNK4lLVEZAJYFltnnk1tJSlbeS9lYA==", + "version": "4.26.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.26.0.tgz", + "integrity": "sha512-rADNgXl1kS/EKnDr3G+m7fB9yeJNnR9kF7xMiXL6mSIWpr3Wg5MhxyfEXy/IlYthsqwBqHOr22boFbf/u6O88A==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "4.22.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.22.0.tgz", - "integrity": "sha512-TkIFeu5JEeSs5ze/4NID+PIcVjgoU3cUQUIZnH3Sb1cEn1lBo7StSV5bwPuJQuoxKXlzAObjYTilOEKRuhR5yg==", + "version": "4.26.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.26.0.tgz", + "integrity": "sha512-GHUgahPcm9GfBuy3TzdsizCcPjKOAauG9xkz9TR8kOdssz2Iz9jRCSQm6+aVFa23d5NcSpo1GdHGSQKe0tlcbg==", "dev": true, "requires": { - "@typescript-eslint/types": "4.22.0", - "@typescript-eslint/visitor-keys": "4.22.0", - "debug": "^4.1.1", - "globby": "^11.0.1", + "@typescript-eslint/types": "4.26.0", + "@typescript-eslint/visitor-keys": "4.26.0", + "debug": "^4.3.1", + "globby": "^11.0.3", "is-glob": "^4.0.1", - "semver": "^7.3.2", - "tsutils": "^3.17.1" + "semver": "^7.3.5", + "tsutils": "^3.21.0" } }, "@typescript-eslint/visitor-keys": { - "version": "4.22.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.22.0.tgz", - "integrity": "sha512-nnMu4F+s4o0sll6cBSsTeVsT4cwxB7zECK3dFxzEjPBii9xLpq4yqqsy/FU5zMfan6G60DKZSCXAa3sHJZrcYw==", + "version": "4.26.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.26.0.tgz", + "integrity": "sha512-cw4j8lH38V1ycGBbF+aFiLUls9Z0Bw8QschP3mkth50BbWzgFS33ISIgBzUMuQ2IdahoEv/rXstr8Zhlz4B1Zg==", "dev": true, "requires": { - "@typescript-eslint/types": "4.22.0", + "@typescript-eslint/types": "4.26.0", "eslint-visitor-keys": "^2.0.0" } }, @@ -917,28 +923,30 @@ "dev": true }, "eslint": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.25.0.tgz", - "integrity": "sha512-TVpSovpvCNpLURIScDRB6g5CYu/ZFq9GfX2hLNIV4dSBKxIWojeDODvYl3t0k0VtMxYeR8OXPCFE5+oHMlGfhw==", + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.28.0.tgz", + "integrity": "sha512-UMfH0VSjP0G4p3EWirscJEQ/cHqnT/iuH6oNZOB94nBjWbMnhGEPxsZm1eyIW0C/9jLI0Fow4W5DXLjEI7mn1g==", "dev": true, "requires": { "@babel/code-frame": "7.12.11", - "@eslint/eslintrc": "^0.4.0", + "@eslint/eslintrc": "^0.4.2", "ajv": "^6.10.0", "chalk": "^4.0.0", "cross-spawn": "^7.0.2", "debug": "^4.0.1", "doctrine": "^3.0.0", "enquirer": "^2.3.5", + "escape-string-regexp": "^4.0.0", "eslint-scope": "^5.1.1", "eslint-utils": "^2.1.0", "eslint-visitor-keys": "^2.0.0", "espree": "^7.3.1", "esquery": "^1.4.0", "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", "file-entry-cache": "^6.0.1", "functional-red-black-tree": "^1.0.1", - "glob-parent": "^5.0.0", + "glob-parent": "^5.1.2", "globals": "^13.6.0", "ignore": "^4.0.6", "import-fresh": "^3.0.0", @@ -947,7 +955,7 @@ "js-yaml": "^3.13.1", "json-stable-stringify-without-jsonify": "^1.0.1", "levn": "^0.4.1", - "lodash": "^4.17.21", + "lodash.merge": "^4.6.2", "minimatch": "^3.0.4", "natural-compare": "^1.4.0", "optionator": "^0.9.1", @@ -956,7 +964,7 @@ "semver": "^7.2.1", "strip-ansi": "^6.0.0", "strip-json-comments": "^3.1.0", - "table": "^6.0.4", + "table": "^6.0.9", "text-table": "^0.2.0", "v8-compile-cache": "^2.0.3" }, @@ -995,10 +1003,33 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, + "escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true + }, + "eslint-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", + "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^1.1.0" + }, + "dependencies": { + "eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true + } + } + }, "globals": { - "version": "13.8.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.8.0.tgz", - "integrity": "sha512-rHtdA6+PDBIjeEvA91rpqzEvk/k3/i7EeNQiryiWuJH0Hw9cpyJMAt2jtbAwUaRdhD+573X4vWw6IcjKPasi9Q==", + "version": "13.9.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.9.0.tgz", + "integrity": "sha512-74/FduwI/JaIrr1H8e71UbDE+5x7pIPs1C2rrwC52SszOo043CsWOZEMW7o2Y58xwm9b+0RBKDxY5n2sUpEFxA==", "dev": true, "requires": { "type-fest": "^0.20.2" @@ -1029,26 +1060,18 @@ } }, "eslint-utils": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", - "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", + "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", "dev": true, "requires": { - "eslint-visitor-keys": "^1.1.0" - }, - "dependencies": { - "eslint-visitor-keys": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", - "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", - "dev": true - } + "eslint-visitor-keys": "^2.0.0" } }, "eslint-visitor-keys": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz", - "integrity": "sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", + "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", "dev": true }, "espree": { @@ -1656,18 +1679,18 @@ "integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=", "dev": true }, - "lodash.flatten": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/lodash.flatten/-/lodash.flatten-4.4.0.tgz", - "integrity": "sha1-8xwiIlqWMtK7+OSt2+8kCqdlph8=", - "dev": true - }, "lodash.flattendeep": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz", "integrity": "sha1-+wMJF/hqMTTlvJvsDWngAT3f7bI=", "dev": true }, + "lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true + }, "lodash.truncate": { "version": "4.4.2", "resolved": "https://registry.npmjs.org/lodash.truncate/-/lodash.truncate-4.4.2.tgz", @@ -1750,9 +1773,9 @@ } }, "marked": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/marked/-/marked-2.0.3.tgz", - "integrity": "sha512-5otztIIcJfPc2qGTN8cVtOJEjNJZ0jwa46INMagrYfk0EvqtRuEHLsEe0LrFS0/q+ZRKT0+kXK7P2T1AN5lWRA==" + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/marked/-/marked-2.0.7.tgz", + "integrity": "sha512-BJXxkuIfJchcXOJWTT2DOL+yFWifFv2yGYOUzvXg8Qz610QKw+sHCvTMYwA+qWGhlA2uivBezChZ/pBy1tWdkQ==" }, "merge2": { "version": "1.4.1", @@ -1784,9 +1807,9 @@ "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" }, "mocha": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-8.3.2.tgz", - "integrity": "sha512-UdmISwr/5w+uXLPKspgoV7/RXZwKRTiTjJ2/AC5ZiEztIoOYdfKb19+9jNmEInzx5pBsCyJQzarAxqIGBNYJhg==", + "version": "8.4.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-8.4.0.tgz", + "integrity": "sha512-hJaO0mwDXmZS4ghXsvPVriOhsxQ7ofcpQdm8dE+jISUOKopitvnXFQmpRR7jd2K6VBG6E26gU3IAbXXGIbu4sQ==", "dev": true, "requires": { "@ungap/promise-all-settled": "1.1.2", @@ -2208,9 +2231,9 @@ "dev": true }, "picomatch": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.3.tgz", - "integrity": "sha512-KpELjfwcCDUb9PeigTs2mBJzXUPzAuP2oPcA989He8Rte0+YUAjw1JVedDhuTKPkHjSYzMN3npC9luThGYEKdg==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz", + "integrity": "sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==", "dev": true }, "pkg-dir": { @@ -2545,14 +2568,13 @@ } }, "table": { - "version": "6.6.0", - "resolved": "https://registry.npmjs.org/table/-/table-6.6.0.tgz", - "integrity": "sha512-iZMtp5tUvcnAdtHpZTWLPF0M7AgiQsURR2DwmxnJwSy8I3+cY+ozzVvYha3BOLG2TB+L0CqjIz+91htuj6yCXg==", + "version": "6.7.1", + "resolved": "https://registry.npmjs.org/table/-/table-6.7.1.tgz", + "integrity": "sha512-ZGum47Yi6KOOFDE8m223td53ath2enHcYLgOCjGr5ngu8bdIARQk6mN/wRMv4yMRcHnCSnHbCEha4sobQx5yWg==", "dev": true, "requires": { "ajv": "^8.0.1", "lodash.clonedeep": "^4.5.0", - "lodash.flatten": "^4.4.0", "lodash.truncate": "^4.4.2", "slice-ansi": "^4.0.0", "string-width": "^4.2.0", @@ -2560,9 +2582,9 @@ }, "dependencies": { "ajv": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.2.0.tgz", - "integrity": "sha512-WSNGFuyWd//XO8n/m/EaOlNLtO0yL8EXT/74LqT4khdhpZjP7lkj/kT5uwRmGitKEVp/Oj7ZUHeGfPtgHhQ5CA==", + "version": "8.5.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.5.0.tgz", + "integrity": "sha512-Y2l399Tt1AguU3BPRP9Fn4eN+Or+StUGWCUpbnFyXSo8NZ9S4uj+AG2pjs5apK+ZMOwYOz1+a+VKvKH7CudXgQ==", "dev": true, "requires": { "fast-deep-equal": "^3.1.1", @@ -2656,9 +2678,9 @@ "integrity": "sha512-fIS001cAYHkyQPidWXmHuhs8usjP5XVJjWB8oZGqkTowZaz3v7g3KDZeeqE82FBrmkAnIBOY3jgy7lnPnqATbA==" }, "typescript": { - "version": "4.2.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.4.tgz", - "integrity": "sha512-V+evlYHZnQkaz8TRBuxTA92yZBPotr5H+WhQ7bD3hZUndx5tGOa1fuCgeSjxAzM1RiN5IzvadIXTVefuuwZCRg==", + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.3.2.tgz", + "integrity": "sha512-zZ4hShnmnoVnAHpVHWpTcxdv7dWP60S2FsydQLV8V5PbS3FifjWFFRiHSWpDJahly88PRyV5teTSLoq4eG7mKw==", "dev": true }, "uglify-js": { diff --git a/package.json b/package.json index 2e6060fe3..53b927842 100644 --- a/package.json +++ b/package.json @@ -23,29 +23,29 @@ "handlebars": "^4.7.7", "lodash": "^4.17.21", "lunr": "^2.3.9", - "marked": "^2.0.3", + "marked": "^2.0.7", "minimatch": "^3.0.0", "progress": "^2.0.3", "shiki": "^0.9.3", "typedoc-default-themes": "^0.12.10" }, "peerDependencies": { - "typescript": "4.0.x || 4.1.x || 4.2.x" + "typescript": "4.0.x || 4.1.x || 4.2.x || 4.3.x" }, "devDependencies": { - "@types/lodash": "^4.14.168", + "@types/lodash": "^4.14.170", "@types/lunr": "^2.3.3", - "@types/marked": "^2.0.2", + "@types/marked": "^2.0.3", "@types/minimatch": "3.0.4", "@types/mocha": "^8.2.2", - "@types/node": "^15.0.1", - "@typescript-eslint/eslint-plugin": "^4.22.0", - "@typescript-eslint/parser": "^4.22.0", - "eslint": "^7.25.0", - "mocha": "^8.3.2", + "@types/node": "^15.12.1", + "@typescript-eslint/eslint-plugin": "^4.26.0", + "@typescript-eslint/parser": "^4.26.0", + "eslint": "^7.28.0", + "mocha": "^8.4.0", "nyc": "^15.1.0", - "prettier": "^2.2.1", - "typescript": "^4.2.4" + "prettier": "2.2.1", + "typescript": "^4.3.2" }, "files": [ "bin", diff --git a/src/lib/converter/context.ts b/src/lib/converter/context.ts index 25c5e280a..837499b48 100644 --- a/src/lib/converter/context.ts +++ b/src/lib/converter/context.ts @@ -78,7 +78,7 @@ export class Context { * /** We should use this comment */ * export * as Mod from "./mod" * ``` - * Will be removed in 0.21. + * Will be removed in 0.22. * @internal */ exportSymbol?: ts.Symbol; @@ -288,6 +288,7 @@ const builtInSymbolRegExp = /^__@(\w+)$/; const uniqueSymbolRegExp = /^__@(.*)@\d+$/; function getHumanName(name: string) { + // TS 4.0, 4.1, 4.2 - well known symbols are treated specially. let match = builtInSymbolRegExp.exec(name); if (match) { return `[Symbol.${match[1]}]`; diff --git a/src/lib/converter/factories/comment.ts b/src/lib/converter/factories/comment.ts index 88bef3bcc..42f153d8b 100644 --- a/src/lib/converter/factories/comment.ts +++ b/src/lib/converter/factories/comment.ts @@ -2,21 +2,7 @@ import * as ts from "typescript"; import { toArray } from "lodash"; import { Comment, CommentTag } from "../../models/comments/index"; - -/** - * Return the parsed comment of the given TypeScript node. - * - * @param node The node whose comment should be returned. - * @return The parsed comment as a [[Comment]] instance or undefined if no comment is present. - */ -export function createComment(node: ts.Node): Comment | undefined { - const comment = getRawComment(node); - if (!comment) { - return; - } - - return parseComment(comment); -} +import { Logger } from "../../utils"; /** * Check whether the given module declaration is the topmost. @@ -88,13 +74,24 @@ function getJSDocCommentRanges(node: ts.Node, text: string): ts.CommentRange[] { ); } +export function getJsDocCommentText(comment: ts.JSDocTag["comment"]) { + if (typeof comment === "string") { + return comment; + } + + return comment?.map((val) => val.text).join(""); +} + /** * Return the raw comment string for the given node. * * @param node The node whose comment should be resolved. * @returns The raw comment string or undefined if no comment could be found. */ -export function getRawComment(node: ts.Node): string | undefined { +export function getRawComment( + node: ts.Node, + logger: Logger +): string | undefined { // This happens if we are converting a JS project that has @typedef "interfaces" // with an @property tag, a @typedef type alias, a callback with parameters, etc. if ( @@ -105,7 +102,7 @@ export function getRawComment(node: ts.Node): string | undefined { ) { // Also strip off leading dashes: // @property {string} name - docs - return node.comment?.replace(/^\s*-\s*/, ""); + return getJsDocCommentText(node.comment)?.replace(/^\s*-\s*/, ""); } if ( @@ -129,52 +126,46 @@ export function getRawComment(node: ts.Node): string | undefined { const comments = getJSDocCommentRanges(node, sourceFile.text); if (comments.length) { let comment: ts.CommentRange; - let explicitPackageComment = comments.find((comment) => - sourceFile.text - .substring(comment.pos, comment.end) - .includes("@module") - ); - // TODO: Deprecate and remove. This is an abuse of the @packageDocumentation tag. See: - // https://github.com/TypeStrong/typedoc/issues/1504#issuecomment-775842609 - // Deprecate in 0.21, remove in 0.22 - explicitPackageComment ??= comments.find((comment) => - sourceFile.text - .substring(comment.pos, comment.end) - .includes("@packageDocumentation") - ); if (node.kind === ts.SyntaxKind.SourceFile) { + const explicitPackageComment = + comments.find((comment) => + sourceFile.text + .substring(comment.pos, comment.end) + .includes("@module") + ) ?? + comments.find((comment) => + sourceFile.text + .substring(comment.pos, comment.end) + .includes("@packageDocumentation") + ); + if (explicitPackageComment) { comment = explicitPackageComment; } else if (comments.length > 1) { // Legacy behavior, require more than one comment and use the first comment. - // FUTURE: GH#1083, follow deprecation process to phase this out. comment = comments[0]; + + logger.deprecated( + `Specifying multiple comments at the start of a file to use the first comment as the comment for the module has been deprecated. Use @module or @packageDocumentation instead.`, + false + ); } else { // Single comment that may be a license comment, or no comments, bail. return; } } else { comment = comments[comments.length - 1]; - // If a non-SourceFile node comment has this tag, it should not be attached to the node - // as it documents the whole file by convention. - // TODO: Deprecate and remove. This is an abuse of the @packageDocumentation tag. See: - // https://github.com/TypeStrong/typedoc/issues/1504#issuecomment-775842609 - // Deprecate in 0.21, remove in 0.22 - if ( - sourceFile.text - .substring(comment.pos, comment.end) - .includes("@packageDocumentation") - ) { - return; - } // If a non-SourceFile node comment has this tag, it should not be attached to the node // as it documents the module. if ( sourceFile.text .substring(comment.pos, comment.end) - .includes("@module") + .includes("@module") || + sourceFile.text + .substring(comment.pos, comment.end) + .includes("@packageDocumentation") ) { return; } diff --git a/src/lib/converter/plugins/CommentPlugin.ts b/src/lib/converter/plugins/CommentPlugin.ts index cb1f45087..89c8cb2fa 100644 --- a/src/lib/converter/plugins/CommentPlugin.ts +++ b/src/lib/converter/plugins/CommentPlugin.ts @@ -9,7 +9,11 @@ import { DeclarationReflection, } from "../../models/reflections/index"; import { Component, ConverterComponent } from "../components"; -import { parseComment, getRawComment } from "../factories/comment"; +import { + parseComment, + getRawComment, + getJsDocCommentText, +} from "../factories/comment"; import { Converter } from "../converter"; import { Context } from "../context"; import { partition, uniq } from "lodash"; @@ -124,8 +128,9 @@ export class CommentPlugin extends ConverterComponent { node?: ts.Node ) { if (node && ts.isJSDocTemplateTag(node.parent)) { - if (node.parent.comment) { - reflection.comment = new Comment(node.parent.comment); + const comment = getJsDocCommentText(node.parent.comment); + if (comment) { + reflection.comment = new Comment(comment); } } @@ -167,10 +172,11 @@ export class CommentPlugin extends ConverterComponent { return; } - // Clean this up in 0.21. We should really accept a ts.Symbol so we don't need exportSymbol on Context + // Clean this up in 0.22. We should really accept a ts.Symbol so we don't need exportSymbol on Context const exportNode = context.exportSymbol?.getDeclarations()?.[0]; - let rawComment = exportNode && getRawComment(exportNode); - rawComment ??= node && getRawComment(node); + let rawComment = + exportNode && getRawComment(exportNode, this.application.logger); + rawComment ??= node && getRawComment(node, this.application.logger); if (!rawComment) { return; } diff --git a/src/lib/converter/symbols.ts b/src/lib/converter/symbols.ts index a68c99201..f81588e1e 100644 --- a/src/lib/converter/symbols.ts +++ b/src/lib/converter/symbols.ts @@ -491,7 +491,7 @@ function convertClassOrInterface( if (instanceType.typeParameters) { reflection.typeParameters = instanceType.typeParameters.map((param) => { const declaration = param.symbol?.declarations?.[0]; - assert(ts.isTypeParameterDeclaration(declaration)); + assert(declaration && ts.isTypeParameterDeclaration(declaration)); return createTypeParamReflection(declaration, reflectionContext); }); } @@ -596,7 +596,9 @@ function convertProperty( reflection.type = context.converter.convertType( context, (context.isConvertingTypeNode() ? parameterType : void 0) ?? - context.checker.getTypeOfSymbolAtLocation(symbol, {} as any) + context.checker.getTypeOfSymbolAtLocation(symbol, { + kind: ts.SyntaxKind.SourceFile, + } as any) ); if (reflection.flags.isOptional) { @@ -801,17 +803,18 @@ function convertVariableAsFunction( .getDeclarations() ?.find(ts.isVariableDeclaration); - const type = context.checker.getTypeOfSymbolAtLocation( - symbol, - declaration ?? symbol.valueDeclaration - ); + const accessDeclaration = declaration ?? symbol.valueDeclaration; + + const type = accessDeclaration + ? context.checker.getTypeOfSymbolAtLocation(symbol, accessDeclaration) + : context.checker.getDeclaredTypeOfSymbol(symbol); const reflection = context.createDeclarationReflection( ReflectionKind.Function, symbol, exportSymbol ); - setModifiers(symbol, declaration ?? symbol.valueDeclaration, reflection); + setModifiers(symbol, accessDeclaration, reflection); // Does anyone care about this? I doubt it... if ( declaration && @@ -906,9 +909,13 @@ function isInherited(context: Context, symbol: ts.Symbol) { function setModifiers( symbol: ts.Symbol, - declaration: ts.Declaration, + declaration: ts.Declaration | undefined, reflection: Reflection ) { + if (!declaration) { + return; + } + const modifiers = ts.getCombinedModifierFlags(declaration); if ( diff --git a/src/lib/utils/loggers.ts b/src/lib/utils/loggers.ts index e3c54fc41..cebdb473a 100644 --- a/src/lib/utils/loggers.ts +++ b/src/lib/utils/loggers.ts @@ -167,10 +167,12 @@ export class Logger { } /** @internal */ - deprecated(text: string) { - const stack = new Error().stack?.split("\n"); - if (stack && stack.length >= 4) { - text = text + "\n" + stack[3]; + deprecated(text: string, addStack = true) { + if (addStack) { + const stack = new Error().stack?.split("\n"); + if (stack && stack.length >= 4) { + text = text + "\n" + stack[3]; + } } if (!this.deprecationWarnings.has(text)) { this.deprecationWarnings.add(text); diff --git a/src/lib/utils/options/options.ts b/src/lib/utils/options/options.ts index 3444d6275..5eae8f5c2 100644 --- a/src/lib/utils/options/options.ts +++ b/src/lib/utils/options/options.ts @@ -1,5 +1,4 @@ -import { isDeepStrictEqual } from "util"; -import * as _ from "lodash"; +import { cloneDeep } from "lodash"; import * as ts from "typescript"; import { @@ -211,21 +210,6 @@ export class Options { return unique(this._declarations.values()); } - /** - * Checks if the given option's value is deeply strict equal to the default. - * @deprecated Will be removed in v0.21. Use `isSet` instead. - * @param name - */ - isDefault(name: keyof TypeDocOptions): boolean; - isDefault(name: NeverIfInternal): boolean; - isDefault(name: string): boolean { - // getValue will throw if the declaration does not exist. - return isDeepStrictEqual( - this.getValue(name as keyof TypeDocOptions), - this.getDefaultOptionValue(this.getDeclaration(name)!) - ); - } - /** * Checks if the given option's value is deeply strict equal to the default. * @param name @@ -243,7 +227,7 @@ export class Options { * Gets all of the TypeDoc option values defined in this option container. */ getRawValues(): Partial { - return _.cloneDeep(this._values); + return cloneDeep(this._values); } /** @@ -291,7 +275,7 @@ export class Options { * Gets the set compiler options. */ getCompilerOptions(): ts.CompilerOptions { - return _.cloneDeep(this._compilerOptions); + return cloneDeep(this._compilerOptions); } /** @@ -325,7 +309,7 @@ export class Options { this.setValue("excludeInternal", true); } this._fileNames = fileNames; - this._compilerOptions = _.cloneDeep(options); + this._compilerOptions = cloneDeep(options); this._projectReferences = projectReferences ?? []; } diff --git a/src/test/converter/class/class.ts b/src/test/converter/class/class.ts index 084a3321e..4197392dd 100644 --- a/src/test/converter/class/class.ts +++ b/src/test/converter/class/class.ts @@ -123,8 +123,8 @@ export class Ts38PrivateFields { } export abstract class Abstract { - abstract needsImpl(): number + abstract needsImpl(): number; } // TS 4.2 -export type AbstractMe = abstract new () => Abstract +export type AbstractMe = abstract new () => Abstract; diff --git a/src/test/converter/class/specs-with-lump-categories.json b/src/test/converter/class/specs-with-lump-categories.json index 87d2d8fdd..f1d8369c3 100644 --- a/src/test/converter/class/specs-with-lump-categories.json +++ b/src/test/converter/class/specs-with-lump-categories.json @@ -446,8 +446,8 @@ ] }, { - "id": 77, - "name": "[Symbol.toStringTag]", + "id": 79, + "name": "[toStringTag]", "kind": 1024, "kindString": "Property", "flags": {}, @@ -470,7 +470,7 @@ "defaultValue": "true" }, { - "id": 78, + "id": 77, "name": "literal2", "kind": 1024, "kindString": "Property", @@ -482,7 +482,7 @@ "defaultValue": "true" }, { - "id": 79, + "id": 78, "name": "y", "kind": 1024, "kindString": "Property", @@ -506,10 +506,10 @@ "title": "Properties", "kind": 1024, "children": [ - 77, + 79, 80, - 78, - 79 + 77, + 78 ] } ] diff --git a/src/test/converter/class/specs.json b/src/test/converter/class/specs.json index 8595c0029..798dd88e0 100644 --- a/src/test/converter/class/specs.json +++ b/src/test/converter/class/specs.json @@ -446,8 +446,8 @@ ] }, { - "id": 77, - "name": "[Symbol.toStringTag]", + "id": 79, + "name": "[toStringTag]", "kind": 1024, "kindString": "Property", "flags": {}, @@ -470,7 +470,7 @@ "defaultValue": "true" }, { - "id": 78, + "id": 77, "name": "literal2", "kind": 1024, "kindString": "Property", @@ -482,7 +482,7 @@ "defaultValue": "true" }, { - "id": 79, + "id": 78, "name": "y", "kind": 1024, "kindString": "Property", @@ -506,10 +506,10 @@ "title": "Properties", "kind": 1024, "children": [ - 77, + 79, 80, - 78, - 79 + 77, + 78 ] } ] diff --git a/src/test/converter/comment/comment2.ts b/src/test/converter/comment/comment2.ts index 05f496e4b..6e15ba3d8 100644 --- a/src/test/converter/comment/comment2.ts +++ b/src/test/converter/comment/comment2.ts @@ -2,8 +2,6 @@ * This is a module doc with the packageDocumentation tag to mark it as documentation * for the whole module. It is *not* documentation for the `multiply` function. * - * This behavior will be deprecated and removed in the future. Use the `module` tag instead. - * * @packageDocumentation */ diff --git a/src/test/converter/comment/specs.json b/src/test/converter/comment/specs.json index f4ccc95e9..6e4b29fa6 100644 --- a/src/test/converter/comment/specs.json +++ b/src/test/converter/comment/specs.json @@ -160,8 +160,7 @@ "kindString": "Module", "flags": {}, "comment": { - "shortText": "This is a module doc with the packageDocumentation tag to mark it as documentation\nfor the whole module. It is *not* documentation for the `multiply` function.", - "text": "This behavior will be deprecated and removed in the future. Use the `module` tag instead.\n" + "shortText": "This is a module doc with the packageDocumentation tag to mark it as documentation\nfor the whole module. It is *not* documentation for the `multiply` function." }, "children": [ { diff --git a/src/test/converter/js/specs.json b/src/test/converter/js/specs.json index c7b757d8e..f8e8648cc 100644 --- a/src/test/converter/js/specs.json +++ b/src/test/converter/js/specs.json @@ -609,17 +609,11 @@ "isRest": true }, "type": { - "type": "union", - "types": [ - { - "type": "intrinsic", - "name": "undefined" - }, - { - "type": "intrinsic", - "name": "string" - } - ] + "type": "array", + "elementType": { + "type": "intrinsic", + "name": "string" + } } } ], diff --git a/src/test/converter/mixin/mixin.ts b/src/test/converter/mixin/mixin.ts index 048fa1f83..72944a872 100644 --- a/src/test/converter/mixin/mixin.ts +++ b/src/test/converter/mixin/mixin.ts @@ -54,15 +54,15 @@ export const Mixin2 = >(base: T) => class Mixin2 extends base { property2 = "init"; - method2(arg: Mixin2): Mixin2[] { - return [arg, this]; + method2(arg: Mixin2Type): Mixin2Type { + return arg; } }; /** * The "instance type" of the Mixin2 using the interface notation (supports recursive type definition) */ -export interface Mixin2 extends Mixin {} +export interface Mixin2Type extends Mixin {} /** * The "mixin function" of the Mixin3 diff --git a/src/test/converter/mixin/specs.json b/src/test/converter/mixin/specs.json index 9553fe1d1..d37523969 100644 --- a/src/test/converter/mixin/specs.json +++ b/src/test/converter/mixin/specs.json @@ -133,7 +133,7 @@ } }, { - "id": 78, + "id": 74, "name": "baseProperty", "kind": 1024, "kindString": "Property", @@ -161,7 +161,7 @@ "defaultValue": "\"init\"" }, { - "id": 74, + "id": 70, "name": "property1", "kind": 1024, "kindString": "Property", @@ -193,14 +193,14 @@ } }, { - "id": 79, + "id": 75, "name": "baseMethod", "kind": 2048, "kindString": "Method", "flags": {}, "signatures": [ { - "id": 80, + "id": 76, "name": "baseMethod", "kind": 4096, "kindString": "Call signature", @@ -241,21 +241,21 @@ ] }, { - "id": 75, + "id": 71, "name": "method1", "kind": 2048, "kindString": "Method", "flags": {}, "signatures": [ { - "id": 76, + "id": 72, "name": "method1", "kind": 4096, "kindString": "Call signature", "flags": {}, "parameters": [ { - "id": 77, + "id": 73, "name": "arg", "kind": 32768, "kindString": "Parameter", @@ -311,104 +311,15 @@ "flags": {}, "type": { "type": "reference", - "id": 37, - "typeArguments": [ - { - "type": "intersection", - "types": [ - { - "type": "reflection", - "declaration": { - "id": 70, - "name": "__type", - "kind": 65536, - "kindString": "Type literal", - "flags": {}, - "children": [ - { - "id": 71, - "name": "prototype", - "kind": 2048, - "kindString": "Method", - "flags": {} - } - ], - "groups": [ - { - "title": "Methods", - "kind": 2048, - "children": [ - 71 - ] - } - ] - } - }, - { - "type": "query", - "queryType": { - "type": "reference", - "id": 13, - "name": "Base" - } - } - ] - } - ], - "name": "Mixin2" + "id": 39, + "name": "Mixin2Type" } } ], "type": { - "type": "array", - "elementType": { - "type": "reference", - "id": 37, - "typeArguments": [ - { - "type": "intersection", - "types": [ - { - "type": "reflection", - "declaration": { - "id": 72, - "name": "__type", - "kind": 65536, - "kindString": "Type literal", - "flags": {}, - "children": [ - { - "id": 73, - "name": "prototype", - "kind": 2048, - "kindString": "Method", - "flags": {} - } - ], - "groups": [ - { - "title": "Methods", - "kind": 2048, - "children": [ - 73 - ] - } - ] - } - }, - { - "type": "query", - "queryType": { - "type": "reference", - "id": 13, - "name": "Base" - } - } - ] - } - ], - "name": "Mixin2" - } + "type": "reference", + "id": 39, + "name": "Mixin2Type" }, "inheritedFrom": { "type": "reference", @@ -434,9 +345,9 @@ "title": "Properties", "kind": 1024, "children": [ - 78, - 63, 74, + 63, + 70, 66 ] }, @@ -444,9 +355,9 @@ "title": "Methods", "kind": 2048, "children": [ - 79, - 64, 75, + 64, + 71, 67 ] } @@ -699,7 +610,7 @@ }, { "id": 39, - "name": "Mixin2", + "name": "Mixin2Type", "kind": 256, "kindString": "Interface", "flags": {}, @@ -854,66 +765,15 @@ "flags": {}, "type": { "type": "reference", - "id": 37, - "typeArguments": [ - { - "type": "reference", - "id": 6, - "typeArguments": [ - { - "type": "intersection", - "types": [ - { - "type": "reference", - "id": 25, - "name": "Mixin1Type" - }, - { - "type": "reference", - "id": 13, - "name": "Base" - } - ] - } - ], - "name": "AnyConstructor" - } - ], - "name": "Mixin2" + "id": 39, + "name": "Mixin2Type" } } ], "type": { - "type": "array", - "elementType": { - "type": "reference", - "id": 37, - "typeArguments": [ - { - "type": "reference", - "id": 6, - "typeArguments": [ - { - "type": "intersection", - "types": [ - { - "type": "reference", - "id": 25, - "name": "Mixin1Type" - }, - { - "type": "reference", - "id": 13, - "name": "Base" - } - ] - } - ], - "name": "AnyConstructor" - } - ], - "name": "Mixin2" - } + "type": "reference", + "id": 39, + "name": "Mixin2Type" }, "inheritedFrom": { "type": "reference", @@ -1141,7 +1001,7 @@ { "type": "reference", "id": 39, - "name": "Mixin2" + "name": "Mixin2Type" } ] }, diff --git a/src/test/converter/variables/specs.json b/src/test/converter/variables/specs.json index 7946ccb4d..59f683919 100644 --- a/src/test/converter/variables/specs.json +++ b/src/test/converter/variables/specs.json @@ -765,7 +765,7 @@ "children": [ { "id": 89, - "name": "[Symbol.toStringTag]", + "name": "[toStringTag]", "kind": 1024, "kindString": "Property", "flags": {}, diff --git a/src/test/converter2.test.ts b/src/test/converter2.test.ts index c1994da95..8ccbfe397 100644 --- a/src/test/converter2.test.ts +++ b/src/test/converter2.test.ts @@ -232,7 +232,8 @@ describe("Converter2", () => { ); const errors = ts.getPreEmitDiagnostics(program); - equal(errors, []); + app.logger.diagnostics(errors); + equal(errors.length, 0); }); for (const [entry, check] of Object.entries(issueTests)) { diff --git a/src/test/converter2/issues/gh1580.ts b/src/test/converter2/issues/gh1580.ts index 3e49d0d3d..763567896 100644 --- a/src/test/converter2/issues/gh1580.ts +++ b/src/test/converter2/issues/gh1580.ts @@ -9,7 +9,7 @@ export class A { } export class B extends A { - prop!: "B"; + declare prop: "B"; run(): void { super.run(); diff --git a/src/test/renderer/specs/classes/mixin.base.html b/src/test/renderer/specs/classes/mixin.base.html index e4e1c8faa..9766b8dfe 100644 --- a/src/test/renderer/specs/classes/mixin.base.html +++ b/src/test/renderer/specs/classes/mixin.base.html @@ -230,7 +230,7 @@

Returns numberMixin1Type
  • - Mixin2 + Mixin2Type
  • AnyConstructor @@ -248,7 +248,7 @@

    Returns numberMixin1Func

  • - Mixin2 + Mixin2
  • Mixin3 diff --git a/src/test/renderer/specs/classes/mixin.someclasswithmixin.html b/src/test/renderer/specs/classes/mixin.someclasswithmixin.html index 9af823c25..e8bd659cf 100644 --- a/src/test/renderer/specs/classes/mixin.someclasswithmixin.html +++ b/src/test/renderer/specs/classes/mixin.someclasswithmixin.html @@ -227,7 +227,7 @@

    Returns

    method2

    @@ -341,7 +341,7 @@

    Returns Mixin1Type

  • - Mixin2 + Mixin2Type
  • AnyConstructor @@ -359,7 +359,7 @@

    Returns Mixin1Func

  • - Mixin2 + Mixin2
  • Mixin3 diff --git a/src/test/renderer/specs/interfaces/mixin.mixin1type.html b/src/test/renderer/specs/interfaces/mixin.mixin1type.html index 01faadf22..d81c8a855 100644 --- a/src/test/renderer/specs/interfaces/mixin.mixin1type.html +++ b/src/test/renderer/specs/interfaces/mixin.mixin1type.html @@ -248,7 +248,7 @@

    Returns
  • - Mixin2 + Mixin2Type
  • AnyConstructor @@ -266,7 +266,7 @@

    Returns Mixin1Func

  • - Mixin2 + Mixin2
  • Mixin3 diff --git a/src/test/renderer/specs/interfaces/mixin.mixin2.html b/src/test/renderer/specs/interfaces/mixin.mixin2type.html similarity index 77% rename from src/test/renderer/specs/interfaces/mixin.mixin2.html rename to src/test/renderer/specs/interfaces/mixin.mixin2type.html index b88e4d690..ee6d406dd 100644 --- a/src/test/renderer/specs/interfaces/mixin.mixin2.html +++ b/src/test/renderer/specs/interfaces/mixin.mixin2type.html @@ -3,7 +3,7 @@ - Mixin2 | typedoc + Mixin2Type | typedoc @@ -58,10 +58,10 @@ mixin
  • - Mixin2 + Mixin2Type
  • -

    Interface Mixin2

    +

    Interface Mixin2Type

    @@ -79,10 +79,10 @@

    Interface Mixin2

    Hierarchy