Skip to content

Compatibility issue with Nodejs 20  #14

@geaaru

Description

@geaaru

Hi, i'm trying to build and install from master branch with Nodejs 20 but I receive this error:

$> npm install 

> constantinople@4.0.1 prepublish
> npm run build


> constantinople@4.0.1 build
> tsc

node_modules/@types/node/index.d.ts:39:1 - error TS1084: Invalid 'reference' directive syntax.

39 /// <reference lib="es2017" />
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


npm error code 2
npm error path /home/geaaru/dev/constantinople
npm error command failed
npm error command sh -c npm run build

npm error A complete log of this run can be found in: /home/geaaru/.npm/_logs/2024-08-05T15_49_07_213Z-debug-0.log

Hereinafter, some data about version used:

$> tsc --version
Version 5.5.4
$>  node --version 
v20.15.0
$> npm --version
10.7.0

Also downgrading to tsc-2.7.1 i have errors.
And I see this if I try to force using tsconfig.json file:

$> tsc -p ./tsconfig.json 
src/index.ts:41:31 - error TS2345: Argument of type 'Expression | PrivateName' is not assignable to parameter of type 'Expression'.
  Type 'PrivateName' is not assignable to type 'Expression'.
    Property 'body' is missing in type 'PrivateName' but required in type 'ClassExpression'.

41       const left = toConstant(expression.left);
                                 ~~~~~~~~~~~~~~~

  node_modules/@babel/types/lib/index.d.ts:1824:5
    1824     body: ClassBody;
             ~~~~
    'body' is declared here.

src/index.ts:43:42 - error TS2345: Argument of type '"+" | "-" | "/" | "%" | "*" | "**" | "&" | "|" | ">>" | ">>>" | "<<" | "^" | "==" | "===" | "!=" | "!==" | "in" | "instanceof" | ">" | "<" | ">=" | "<=" | "|>"' is not assignable to parameter of type 'Operator'.
  Type '"|>"' is not assignable to type 'Operator'.

43       return constant && binaryOperation(expression.operator, left, right);
                                            ~~~~~~~~~~~~~~~~~~~

src/index.ts:73:24 - error TS2345: Argument of type 'Expression | PrivateName' is not assignable to parameter of type 'Expression'.

73           ? toConstant(expression.callee.property)
                          ~~~~~~~~~~~~~~~~~~~~~~~~~~

src/index.ts:125:22 - error TS2345: Argument of type 'Expression | PrivateName' is not assignable to parameter of type 'Expression'.

125         ? toConstant(expression.property)
                         ~~~~~~~~~~~~~~~~~~~

src/index.ts:153:26 - error TS2345: Argument of type 'Expression | PrivateName' is not assignable to parameter of type 'Expression'.

153             ? toConstant(property.key)
                             ~~~~~~~~~~~~

src/index.ts:205:37 - error TS2345: Argument of type 'Expression | TSType' is not assignable to parameter of type 'Expression'.
  Type 'TSAnyKeyword' is not assignable to type 'Expression'.
    Property 'expression' is missing in type 'TSAnyKeyword' but required in type 'TSNonNullExpression'.

205           result += '' + toConstant(expression.expressions[i]);
                                        ~~~~~~~~~~~~~~~~~~~~~~~~~

  node_modules/@babel/types/lib/index.d.ts:2850:5
    2850     expression: Expression;
             ~~~~~~~~~~
    'expression' is declared here.


Found 6 errors in the same file, starting at: src/index.ts:41

Could this be a compatibility problem with Nodejs20?

Thanks in advance for any suggestions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions