typescript-is icon indicating copy to clipboard operation
typescript-is copied to clipboard

Incompatible with TypeScript 4.8

Open ViSaturn opened this issue 3 years ago • 2 comments

The result of attempting running ttsc with typescript-is on TypeScript 4.8.2:

DeprecationWarning: 'createIdentifier' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createParameterDeclaration' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createEmptyStatement' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createTypeOfExpression' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createStringLiteral' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createStrictInequality' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createNull' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createStrictEquality' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: '' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createCallExpression' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createBinaryExpression' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createPropertyAssignment' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createObjectLiteralExpression' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createReturnStatement' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createIfStatement' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createBlock' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createFunctionDeclaration' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.

/home/pac/project/node_modules/typescript/lib/typescript.js:119152
                throw e;
                ^
NestedError: Failed to transform node at: /home/pac/project/spec/index.ts:285:18
    at transformNodeAndChildren (/home/pac/project/node_modules/typescript-is/lib/transform-inline/transformer.js:60:15)
    at /home/pac/project/node_modules/typescript-is/lib/transform-inline/transformer.js:62:62
    at visitArrayWorker (/home/pac/project/node_modules/typescript/lib/typescript.js:90614:48)
    at visitNodes (/home/pac/project/node_modules/typescript/lib/typescript.js:90577:23)
    at Object.visitEachChild (/home/pac/project/node_modules/typescript/lib/typescript.js:90934:173)
    at transformNodeAndChildren (/home/pac/project/node_modules/typescript-is/lib/transform-inline/transformer.js:62:15)
    at /home/pac/project/node_modules/typescript-is/lib/transform-inline/transformer.js:62:62
    at visitNode (/home/pac/project/node_modules/typescript/lib/typescript.js:90525:23)
    at Object.visitEachChild (/home/pac/project/node_modules/typescript/lib/typescript.js:90920:69)
    at transformNodeAndChildren (/home/pac/project/node_modules/typescript-is/lib/transform-inline/transformer.js:62:15)
Caused By: TypeError: Cannot create property 'pos' on string '_string'
    at setTextRangePos (/home/pac/project/node_modules/typescript/lib/typescript.js:21409:19)
    at Object.setTextRangePosEnd (/home/pac/project/node_modules/typescript/lib/typescript.js:21427:32)
    at createNodeArray (/home/pac/project/node_modules/typescript/lib/typescript.js:23022:16)
    at asNodeArray (/home/pac/project/node_modules/typescript/lib/typescript.js:27553:28)
    at createBaseGenericNamedDeclaration (/home/pac/project/node_modules/typescript/lib/typescript.js:23074:35)
    at createBaseSignatureDeclaration (/home/pac/project/node_modules/typescript/lib/typescript.js:23081:24)
    at createBaseFunctionLikeDeclaration (/home/pac/project/node_modules/typescript/lib/typescript.js:23101:24)
    at Object.createFunctionDeclaration (/home/pac/project/node_modules/typescript/lib/typescript.js:25401:24)
    at Object.createFunctionDeclaration (/home/pac/project/node_modules/typescript/lib/typescript.js:3324:29)
    at createAssertionFunction (/home/pac/project/node_modules/typescript-is/lib/transform-inline/visitor-utils.js:336:15) {
  nested: TypeError: Cannot create property 'pos' on string '_string'
      at setTextRangePos (/home/pac/project/node_modules/typescript/lib/typescript.js:21409:19)
      at Object.setTextRangePosEnd (/home/pac/project/node_modules/typescript/lib/typescript.js:21427:32)
      at createNodeArray (/home/pac/project/node_modules/typescript/lib/typescript.js:23022:16)
      at asNodeArray (/home/pac/project/node_modules/typescript/lib/typescript.js:27553:28)
      at createBaseGenericNamedDeclaration (/home/pac/project/node_modules/typescript/lib/typescript.js:23074:35)
      at createBaseSignatureDeclaration (/home/pac/project/node_modules/typescript/lib/typescript.js:23081:24)
      at createBaseFunctionLikeDeclaration (/home/pac/project/node_modules/typescript/lib/typescript.js:23101:24)
      at Object.createFunctionDeclaration (/home/pac/project/node_modules/typescript/lib/typescript.js:25401:24)
      at Object.createFunctionDeclaration (/home/pac/project/node_modules/typescript/lib/typescript.js:3324:29)
      at createAssertionFunction (/home/pac/project/node_modules/typescript-is/lib/transform-inline/visitor-utils.js:336:15)
}

As soon as I switch back to TypeScript 4.7.2 the errors go away. The TypeScript peer dependency in the package.json should probably be something like this until the problem is solved then:

"typescript": ">=4.1.5 <4.7.2"

Instead of this (what it is currently):

"typescript": "^4.1.5"

which accepts TypeScript 4.8.2 as a version

ViSaturn avatar Aug 28 '22 20:08 ViSaturn

It seems that typescript-is has stopped maintaining.

Therefore, I've made a competitive library and enhanced much more features.

https://github.com/samchon/typia

The new library works on TS 4.8

samchon avatar Sep 04 '22 13:09 samchon

Same issue here

SunHuawei avatar Feb 16 '23 11:02 SunHuawei