Skip to content

Typescript build error : v5.7.0 #2266

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Fab-z4qx opened this issue Oct 10, 2019 · 5 comments
Closed

Typescript build error : v5.7.0 #2266

Fab-z4qx opened this issue Oct 10, 2019 · 5 comments

Comments

@Fab-z4qx
Copy link

Fab-z4qx commented Oct 10, 2019

Hello i got some strange compilation error on node only project :

node_modules/@sentry/utils/dist/is.d.ts:64:51 - error TS2304: Cannot find name 'Event'.
64 export declare function isEvent(wat: any): wat is Event;
                                                     ~~~~~

node_modules/@sentry/utils/dist/is.d.ts:72:53 - error TS2304: Cannot find name 'Element'.
72 export declare function isElement(wat: any): wat is Element;
                                                       ~~~~~~~

node_modules/@sentry/utils/dist/misc.d.ts:89:48 - error TS2304: Cannot find name 'Node'.
89 export declare function htmlTreeAsString(elem: Node): string;

Version:

"@sentry/node": "^5.7.0",

node : v10.16.3

@kamilogorek
Copy link
Contributor

Event, Element and Node are part of TypeScript built-in dom annotations. It should work just fine out-of-the-box, unless you overwrote lib config afair. Can you post your tsconfig.json file?

@Fab-z4qx
Copy link
Author

Fab-z4qx commented Oct 11, 2019

Hi @kamilogorek,

My config :

{
    "compilerOptions": {
        "experimentalDecorators": true,
        "forceConsistentCasingInFileNames": true,
        "noImplicitAny": true,
        "noUnusedLocals": true,
        "emitDecoratorMetadata": true,
        "sourceMap": true,
        "noFallthroughCasesInSwitch": true,
        "target": "es2017",
        "lib": ["es2017"],
        "module": "commonjs",
        "newLine": "LF",
        "charset": "utf8",
        "suppressImplicitAnyIndexErrors": true,
        "alwaysStrict": true,
        "outDir":"dist",
        "plugins": [
            {
                "name": "tslint-language-service"
            }
        ]
    },
    "exclude": [
        "dist",
        "temp",
        "node_modules",
        "output",
        "log",
        "test-data",
        "generated",
        ".*"
    ]
}

And my package.json

{
  "name": "",
  "version": "1.0.0",
  "description": "",
  "main": "src/server.ts",
  "scripts": {
    "test": "NODE_ENV=test nyc ./node_modules/.bin/mocha --opts tests/mocha.opts -r ts-node/register tests/**/*test.ts --exit",
    "test-release": "NODE_ENV=release nyc ./node_modules/.bin/mocha --opts tests/mocha.opts -r ts-node/register tests/**/*test.ts --exit",
    "start-dev": "NODE_ENV=development && npm run compile && node ./dist/src/index.js",
    "start": "node ./dist/src/index.js",
    "compile": "tsc",
    "lint": "tsc --noEmit && eslint '*/**/*.{ts,tsx}'",
    "lint-fix": "tsc --noEmit && eslint '*/**/*.{ts,tsx}' --quiet --fix",
    "prod": "node dist/src/index.js ",
    "watch-ts": "nodemon src/server.ts"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@sentry/node": "^5.7.0",
    "@types/amqplib": "^0.5.13",
    "@types/config": "0.0.34",
    "@types/joi": "^14.3.3",
    "@types/lodash": "4.14.136",
    "@types/node-cron": "^2.0.2",
    "@types/semver": "^6.0.1",
    "amqplib": "^0.5.5",
    "config": "^3.2.2",
    "discord-webhook-ts": "^3.0.3",
    "joi": "^14.3.1",
    "mockgoose-fix": "7.3.6",
    "mongoose": "^5.6.9",
    "node-cron": "^2.0.3",
    "prom-client": "^11.5.3",
    "tsconfig-extends": "^1.0.1",
    "webhook-discord": "^3.2.0",
    "winston": "^3.2.1"
  },
  "devDependencies": {
    "@types/chai": "^4.1.7",
    "@types/fs-extra": "8.0.0",
    "@types/mocha": "^5.2.7",
    "@types/node": "^12.7.12",
    "@types/sinon": "^7.0.13",
    "@typescript-eslint/parser": "^2.0.0",
    "chai": "^4.2.0",
    "eslint": "^5.16.0",
    "eslint-config-airbnb-base": "^13.2.0",
    "eslint-config-prettier": "^6.1.0",
    "eslint-plugin-import": "^2.18.2",
    "fs-extra": "8.1.0",
    "mocha": "^6.2.0",
    "nodemon": "^1.19.1",
    "nyc": "^14.1.1",
    "prettier": "^1.18.2",
    "sinon": "^7.3.2",
    "ts-node": "^8.3.0",
    "tslint": "^5.18.0",
    "typescript": "^3.5.3"
  },
  "nyc": {
    "extends": "@istanbuljs/nyc-config-typescript",
    "check-coverage": true,
    "extension": [
      ".ts",
      ".tsx"
    ],
    "exclude": [
      "**/*.d.ts",
      "coverage/*",
      "tests/*"
    ],
    "reporter": [
      "html",
      "text"
    ],
    "all": true,
    "lines": 0
  }
}

Do you see something strange here ?
I don't think there is an environment problem because I got the same error on my gitlab-ci.

@kamilogorek
Copy link
Contributor

Do you see something strange here ?

By setting lib: ['es2017'], you overwrote the defaults, which are provided by target: 'es2017' already.
You can either remove whole lib line (it shouldn't change anything, as target will set everything for you), or add dom to the array.
(I was able to repro it locally and both of those solutions fix it).

@Fab-z4qx
Copy link
Author

Ok, it's working by removing the line lib.

Tanks you !!

@kamilogorek
Copy link
Contributor

Fixed in 5.7.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants