Skip to content
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

transpilation errors raised due to got in typescript #2137

Closed
2 tasks done
luichooy opened this issue Sep 9, 2022 · 1 comment
Closed
2 tasks done

transpilation errors raised due to got in typescript #2137

luichooy opened this issue Sep 9, 2022 · 1 comment

Comments

@luichooy
Copy link

luichooy commented Sep 9, 2022

Describe the bug

  • Node.js version: 14.16.1
  • OS & version: MacOS
  • typescript: 4.3.5 & 4.8.2 & 3.x.x
  • got: 12.4.1

Actual behavior

I installed got@12 as devDependencies for benchmark test and not use in source directory (src)
I guess some tools use it when i run npm run build

when i use typescript to compile the project, transpilation errors raised due to got. Errors are as follow:

node_modules/got/dist/source/core/index.d.ts:15:24 - error TS1005: ',' expected.

15 import Options, { type NativeRequestOptions } from './options.js';
                          ~~~~~~~~~~~~~~~~~~~~

node_modules/got/dist/source/core/index.d.ts:16:15 - error TS1005: ',' expected.

16 import { type PlainResponse, type Response } from './response.js';
                 ~~~~~~~~~~~~~

node_modules/got/dist/source/core/index.d.ts:16:35 - error TS1005: ',' expected.

16 import { type PlainResponse, type Response } from './response.js';
                                     ~~~~~~~~

node_modules/got/dist/source/core/options.d.ts:21:29 - error TS1005: ',' expected.

21 import http2wrapper, { type ClientHttp2Session } from 'http2-wrapper';

I solved it by downgrading Got to 11.x.x. Because version 11.x.x has no import type syntax.

Expected behavior

I'm confused about whether this is a got problem or a typescript problem

Code to reproduce

tsconfig.json

{
  "compilerOptions": {
    "target": "es5",
    "outDir": "./lib",
    "skipLibCheck": true
  },
  "include": ["src/**/*", "./types/*.d.ts"],
}

Checklist

  • I have read the documentation.
  • I have tried my code with the latest version of Node.js and Got.
@proton-ab
Copy link

Duplicate of #2129

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

3 participants