cypress-io / cypress

Fast, easy and reliable testing for anything that runs in a browser.
https://cypress.io
MIT License
46.68k stars 3.16k forks source link

dtslint TypeError: DeprecationError: 'originalKeywordKind' #30063

Open MikeMcC399 opened 3 weeks ago

MikeMcC399 commented 3 weeks ago

Current behavior

Executing the following command locally causes multiple errors to be reported:

yarn workspace cypress dtslint

The errors are similar to:

The 'unnecessary-bind' rule threw an error in '/home/mike/github/cypress-io/cypress/cli/types/cy-chai.d.ts':
TypeError: DeprecationError: 'originalKeywordKind' has been deprecated since v5.0.0 and can no longer be used. Use 'identifierToKeywordKind(identifier)' instead.

Desired behavior

yarn workspace cypress dtslint

should not throw errors.

Test code to reproduce

git clone https://github.com/cypress-io/cypress
cd cypress
git clean -xfd # in case of repetition
yarn
rm -rf ~/.dts/typescript-installs
yarn workspace cypress dtslint

Cypress Version

Original reported on version 13.13.3 Continues to be reproducible with version 13.14.2

Node version

v18.17.1

Operating System

Ubuntu 22.04.4 LTS

Debug Logs

$ yarn workspace cypress dtslint
yarn workspace v1.22.22
yarn run v1.22.22
$ dtslint types
Installing to /home/mike/.dts/typescript-installs/3.5...
npm WARN config shrinkwrap Use the --package-lock setting instead.

Installed!

Installing to /home/mike/.dts/typescript-installs/3.6...
npm WARN config shrinkwrap Use the --package-lock setting instead.

Installed!

Installing to /home/mike/.dts/typescript-installs/3.7...
npm WARN config shrinkwrap Use the --package-lock setting instead.

Installed!

Installing to /home/mike/.dts/typescript-installs/3.8...
npm WARN config shrinkwrap Use the --package-lock setting instead.

Installed!

Installing to /home/mike/.dts/typescript-installs/3.9...
npm WARN config shrinkwrap Use the --package-lock setting instead.

Installed!

Installing to /home/mike/.dts/typescript-installs/4.0...
npm WARN config shrinkwrap Use the --package-lock setting instead.

Installed!

Installing to /home/mike/.dts/typescript-installs/4.1...
npm WARN config shrinkwrap Use the --package-lock setting instead.

Installed!

Installing to /home/mike/.dts/typescript-installs/4.2...
npm WARN config shrinkwrap Use the --package-lock setting instead.

Installed!

Installing to /home/mike/.dts/typescript-installs/4.3...
npm WARN config shrinkwrap Use the --package-lock setting instead.

Installed!

The 'unnecessary-bind' rule threw an error in '/home/mike/github/cypress-io/cypress/cli/types/cy-chai.d.ts':
TypeError: DeprecationError: 'originalKeywordKind' has been deprecated since v5.0.0 and can no longer be used. Use 'identifierToKeywordKind(identifier)' instead.
    at /home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:172041:13
    at IdentifierObject.<anonymous> (/home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:172071:7)
    at cb (/home/mike/github/cypress-io/cypress/node_modules/tsutils/util/usage.js:567:39)
    at Array.forEach (<anonymous>)
    at UsageWalker._handleFunctionLikeDeclaration (/home/mike/github/cypress-io/cypress/node_modules/tsutils/util/usage.js:644:25)
    at cb (/home/mike/github/cypress-io/cypress/node_modules/tsutils/util/usage.js:558:34)
    at visitNodes (/home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:28081:24)
    at forEachChildInInterfaceDeclaration (/home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:28773:203)
    at Object.forEachChild (/home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:28166:37)
    at forEachChild (/home/mike/github/cypress-io/cypress/node_modules/tsutils/util/usage.js:615:23)
The 'unnecessary-bind' rule threw an error in '/home/mike/github/cypress-io/cypress/cli/types/cy-minimatch.d.ts':
TypeError: DeprecationError: 'originalKeywordKind' has been deprecated since v5.0.0 and can no longer be used. Use 'identifierToKeywordKind(identifier)' instead.
    at /home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:172041:13
    at IdentifierObject.<anonymous> (/home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:172071:7)
    at cb (/home/mike/github/cypress-io/cypress/node_modules/tsutils/util/usage.js:567:39)
    at Array.forEach (<anonymous>)
    at UsageWalker._handleFunctionLikeDeclaration (/home/mike/github/cypress-io/cypress/node_modules/tsutils/util/usage.js:644:25)
    at cb (/home/mike/github/cypress-io/cypress/node_modules/tsutils/util/usage.js:558:34)
    at visitNodes (/home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:28081:24)
    at forEachChildInBlock (/home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:28126:12)
    at Object.forEachChild (/home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:28166:37)
    at cb (/home/mike/github/cypress-io/cypress/node_modules/tsutils/util/usage.js:596:23)
The 'unnecessary-bind' rule threw an error in '/home/mike/github/cypress-io/cypress/cli/types/cypress-eventemitter.d.ts':
TypeError: DeprecationError: 'originalKeywordKind' has been deprecated since v5.0.0 and can no longer be used. Use 'identifierToKeywordKind(identifier)' instead.
    at /home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:172041:13
    at IdentifierObject.<anonymous> (/home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:172071:7)
    at cb (/home/mike/github/cypress-io/cypress/node_modules/tsutils/util/usage.js:567:39)
    at Array.forEach (<anonymous>)
    at UsageWalker._handleFunctionLikeDeclaration (/home/mike/github/cypress-io/cypress/node_modules/tsutils/util/usage.js:644:25)
    at cb (/home/mike/github/cypress-io/cypress/node_modules/tsutils/util/usage.js:558:34)
    at visitNode2 (/home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:28073:20)
    at forEachChildInPropertySignature (/home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:28541:140)
    at Object.forEachChild (/home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:28166:37)
    at cb (/home/mike/github/cypress-io/cypress/node_modules/tsutils/util/usage.js:596:23)
The 'unnecessary-bind' rule threw an error in '/home/mike/github/cypress-io/cypress/cli/types/cypress-npm-api.d.ts':
TypeError: DeprecationError: 'originalKeywordKind' has been deprecated since v5.0.0 and can no longer be used. Use 'identifierToKeywordKind(identifier)' instead.
    at /home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:172041:13
    at IdentifierObject.<anonymous> (/home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:172071:7)
    at cb (/home/mike/github/cypress-io/cypress/node_modules/tsutils/util/usage.js:567:39)
    at Array.forEach (<anonymous>)
    at UsageWalker._handleFunctionLikeDeclaration (/home/mike/github/cypress-io/cypress/node_modules/tsutils/util/usage.js:644:25)
    at cb (/home/mike/github/cypress-io/cypress/node_modules/tsutils/util/usage.js:558:34)
    at visitNodes (/home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:28081:24)
    at forEachChildInInterfaceDeclaration (/home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:28773:203)
    at Object.forEachChild (/home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:28166:37)
    at forEachChild (/home/mike/github/cypress-io/cypress/node_modules/tsutils/util/usage.js:615:23)
The 'unnecessary-bind' rule threw an error in '/home/mike/github/cypress-io/cypress/cli/types/cypress.d.ts':
TypeError: DeprecationError: 'originalKeywordKind' has been deprecated since v5.0.0 and can no longer be used. Use 'identifierToKeywordKind(identifier)' instead.
    at /home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:172041:13
    at IdentifierObject.<anonymous> (/home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:172071:7)
    at cb (/home/mike/github/cypress-io/cypress/node_modules/tsutils/util/usage.js:567:39)
    at Array.forEach (<anonymous>)
    at UsageWalker._handleFunctionLikeDeclaration (/home/mike/github/cypress-io/cypress/node_modules/tsutils/util/usage.js:644:25)
    at cb (/home/mike/github/cypress-io/cypress/node_modules/tsutils/util/usage.js:558:34)
    at visitNode2 (/home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:28073:20)
    at forEachChildInTypeAliasDeclaration (/home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:28776:150)
    at Object.forEachChild (/home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:28166:37)
    at forEachChild (/home/mike/github/cypress-io/cypress/node_modules/tsutils/util/usage.js:615:23)
The 'unnecessary-bind' rule threw an error in '/home/mike/github/cypress-io/cypress/cli/types/tests/actions.ts':
TypeError: DeprecationError: 'originalKeywordKind' has been deprecated since v5.0.0 and can no longer be used. Use 'identifierToKeywordKind(identifier)' instead.
    at /home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:172041:13
    at IdentifierObject.<anonymous> (/home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:172071:7)
    at cb (/home/mike/github/cypress-io/cypress/node_modules/tsutils/util/usage.js:567:39)
    at Array.forEach (<anonymous>)
    at UsageWalker._handleFunctionLikeDeclaration (/home/mike/github/cypress-io/cypress/node_modules/tsutils/util/usage.js:644:25)
    at cb (/home/mike/github/cypress-io/cypress/node_modules/tsutils/util/usage.js:558:34)
    at visitNodes (/home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:28081:24)
    at forEachChildInCallOrNewExpression (/home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:28123:101)
    at Object.forEachChild (/home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:28166:37)
    at cb (/home/mike/github/cypress-io/cypress/node_modules/tsutils/util/usage.js:596:23)
The 'unnecessary-bind' rule threw an error in '/home/mike/github/cypress-io/cypress/cli/types/tests/chainer-examples.ts':
TypeError: DeprecationError: 'originalKeywordKind' has been deprecated since v5.0.0 and can no longer be used. Use 'identifierToKeywordKind(identifier)' instead.
    at /home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:172041:13
    at IdentifierObject.<anonymous> (/home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:172071:7)
    at cb (/home/mike/github/cypress-io/cypress/node_modules/tsutils/util/usage.js:567:39)
    at Array.forEach (<anonymous>)
    at UsageWalker._handleFunctionLikeDeclaration (/home/mike/github/cypress-io/cypress/node_modules/tsutils/util/usage.js:644:25)
    at cb (/home/mike/github/cypress-io/cypress/node_modules/tsutils/util/usage.js:558:34)
    at visitNodes (/home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:28081:24)
    at forEachChildInCallOrNewExpression (/home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:28123:101)
    at Object.forEachChild (/home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:28166:37)
    at cb (/home/mike/github/cypress-io/cypress/node_modules/tsutils/util/usage.js:596:23)
The 'unnecessary-bind' rule threw an error in '/home/mike/github/cypress-io/cypress/cli/types/tests/cypress-npm-api-test.ts':
TypeError: DeprecationError: 'originalKeywordKind' has been deprecated since v5.0.0 and can no longer be used. Use 'identifierToKeywordKind(identifier)' instead.
    at /home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:172041:13
    at IdentifierObject.<anonymous> (/home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:172071:7)
    at cb (/home/mike/github/cypress-io/cypress/node_modules/tsutils/util/usage.js:567:39)
    at Array.forEach (<anonymous>)
    at UsageWalker._handleFunctionLikeDeclaration (/home/mike/github/cypress-io/cypress/node_modules/tsutils/util/usage.js:644:25)
    at cb (/home/mike/github/cypress-io/cypress/node_modules/tsutils/util/usage.js:558:34)
    at visitNodes (/home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:28081:24)
    at forEachChildInCallOrNewExpression (/home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:28123:101)
    at Object.forEachChild (/home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:28166:37)
    at cb (/home/mike/github/cypress-io/cypress/node_modules/tsutils/util/usage.js:596:23)
The 'unnecessary-bind' rule threw an error in '/home/mike/github/cypress-io/cypress/cli/types/tests/cypress-tests.ts':
TypeError: DeprecationError: 'originalKeywordKind' has been deprecated since v5.0.0 and can no longer be used. Use 'identifierToKeywordKind(identifier)' instead.
    at /home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:172041:13
    at IdentifierObject.<anonymous> (/home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:172071:7)
    at cb (/home/mike/github/cypress-io/cypress/node_modules/tsutils/util/usage.js:567:39)
    at Array.forEach (<anonymous>)
    at UsageWalker._handleFunctionLikeDeclaration (/home/mike/github/cypress-io/cypress/node_modules/tsutils/util/usage.js:644:25)
    at cb (/home/mike/github/cypress-io/cypress/node_modules/tsutils/util/usage.js:558:34)
    at visitNodes (/home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:28081:24)
    at forEachChildInCallOrNewExpression (/home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:28123:101)
    at Object.forEachChild (/home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:28166:37)
    at cb (/home/mike/github/cypress-io/cypress/node_modules/tsutils/util/usage.js:596:23)
The 'unnecessary-bind' rule threw an error in '/home/mike/github/cypress-io/cypress/cli/types/tests/kitchen-sink.ts':
TypeError: DeprecationError: 'originalKeywordKind' has been deprecated since v5.0.0 and can no longer be used. Use 'identifierToKeywordKind(identifier)' instead.
    at /home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:172041:13
    at IdentifierObject.<anonymous> (/home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:172071:7)
    at cb (/home/mike/github/cypress-io/cypress/node_modules/tsutils/util/usage.js:567:39)
    at Array.forEach (<anonymous>)
    at UsageWalker._handleFunctionLikeDeclaration (/home/mike/github/cypress-io/cypress/node_modules/tsutils/util/usage.js:644:25)
    at cb (/home/mike/github/cypress-io/cypress/node_modules/tsutils/util/usage.js:558:34)
    at visitNodes (/home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:28081:24)
    at forEachChildInCallOrNewExpression (/home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:28123:101)
    at Object.forEachChild (/home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:28166:37)
    at cb (/home/mike/github/cypress-io/cypress/node_modules/tsutils/util/usage.js:596:23)
The 'unnecessary-bind' rule threw an error in '/home/mike/github/cypress-io/cypress/cli/types/tests/net-stubbing-tests.ts':
TypeError: DeprecationError: 'originalKeywordKind' has been deprecated since v5.0.0 and can no longer be used. Use 'identifierToKeywordKind(identifier)' instead.
    at /home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:172041:13
    at IdentifierObject.<anonymous> (/home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:172071:7)
    at cb (/home/mike/github/cypress-io/cypress/node_modules/tsutils/util/usage.js:567:39)
    at Array.forEach (<anonymous>)
    at UsageWalker._handleFunctionLikeDeclaration (/home/mike/github/cypress-io/cypress/node_modules/tsutils/util/usage.js:644:25)
    at cb (/home/mike/github/cypress-io/cypress/node_modules/tsutils/util/usage.js:558:34)
    at visitNode2 (/home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:28073:20)
    at forEachChildInVariableDeclaration (/home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:28547:96)
    at Object.forEachChild (/home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:28166:37)
    at cb (/home/mike/github/cypress-io/cypress/node_modules/tsutils/util/usage.js:596:23)
The 'unnecessary-bind' rule threw an error in '/home/mike/github/cypress-io/cypress/cli/types/tests/plugins-config.ts':
TypeError: DeprecationError: 'originalKeywordKind' has been deprecated since v5.0.0 and can no longer be used. Use 'identifierToKeywordKind(identifier)' instead.
    at /home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:172041:13
    at IdentifierObject.<anonymous> (/home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:172071:7)
    at cb (/home/mike/github/cypress-io/cypress/node_modules/tsutils/util/usage.js:567:39)
    at Array.forEach (<anonymous>)
    at UsageWalker._handleFunctionLikeDeclaration (/home/mike/github/cypress-io/cypress/node_modules/tsutils/util/usage.js:644:25)
    at cb (/home/mike/github/cypress-io/cypress/node_modules/tsutils/util/usage.js:558:34)
    at visitNode2 (/home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:28073:20)
    at forEachChildInVariableDeclaration (/home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:28547:129)
    at Object.forEachChild (/home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:28166:37)
    at cb (/home/mike/github/cypress-io/cypress/node_modules/tsutils/util/usage.js:596:23)
The 'unnecessary-bind' rule threw an error in '/home/mike/github/cypress-io/cypress/cli/types/tests/plugins-test.ts':
TypeError: DeprecationError: 'originalKeywordKind' has been deprecated since v5.0.0 and can no longer be used. Use 'identifierToKeywordKind(identifier)' instead.
    at /home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:172041:13
    at IdentifierObject.<anonymous> (/home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:172071:7)
    at cb (/home/mike/github/cypress-io/cypress/node_modules/tsutils/util/usage.js:567:39)
    at Array.forEach (<anonymous>)
    at UsageWalker._handleFunctionLikeDeclaration (/home/mike/github/cypress-io/cypress/node_modules/tsutils/util/usage.js:644:25)
    at cb (/home/mike/github/cypress-io/cypress/node_modules/tsutils/util/usage.js:558:34)
    at visitNodes (/home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:28081:24)
    at forEachChildInInterfaceDeclaration (/home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:28773:203)
    at Object.forEachChild (/home/mike/github/cypress-io/cypress/node_modules/typescript/lib/typescript.js:28166:37)
    at forEachChild (/home/mike/github/cypress-io/cypress/node_modules/tsutils/util/usage.js:615:23)
Done in 28.67s.

Other

Cypress is configured to use dtslint@4.0.7 which was published 4 years ago.

https://github.com/cypress-io/cypress/blob/6cce2d7dae8f87a1aaa18638bbf032c94d5a9e1b/cli/package.json#L94

This package has been deprecated - see https://www.npmjs.com/package/dtslint and https://github.com/Microsoft/dtslint (showing the repo archived).

It appears not to test with TypeScript v5 despite the error messages.

jennifer-shehane commented 3 weeks ago

@MikeMcC399 tsd seems the most equivalent for what we're using this for. This is only used in the CLI to test our types there. I would suggest migrating to tsd: https://github.com/tsdjs/tsd

jennifer-shehane commented 3 weeks ago

Bumping the dtslint version to latest in the meantime - might as well. https://github.com/cypress-io/cypress/pull/30065

MikeMcC399 commented 3 weeks ago

@jennifer-shehane

tsd seems the most equivalent for what we're using this for. This is only used in the CLI to test our types there. I would suggest migrating to tsd: https://github.com/tsdjs/tsd

MikeMcC399 commented 3 weeks ago

@jennifer-shehane

Bumping the dtslint version to latest in the meantime - might as well. #30065

The repo https://github.com/microsoft/dtslint doesn't show releases cleanly or contain any changelog.

You'd need to read commits in https://github.com/microsoft/dtslint/commits/master/ to understand what the version update might achieve.

MikeMcC399 commented 3 weeks ago
jennifer-shehane commented 3 weeks ago

Yah, I didn't quite think it would be resolved. Sounds good.