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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parcel 2 generates wrong declaration file when declare global is used #7455

Closed
jakubmazanec opened this issue Dec 16, 2021 · 2 comments
Closed

Comments

@jakubmazanec
Copy link

jakubmazanec commented Dec 16, 2021

declare global in TypeScript file makes Parcel generate wrong declaration file:

// src/index.ts
declare global {}

class Foo {
}

export const foo = new Foo();
// dist src/index.d.ts
// no foos? 馃槶

馃帥 Configuration

Simple setup with config only via package.json

{
  "name": "parcel-bug-declare-global",
  "version": "1.0.0",
  "main": "dist/index.js",
  "source": "src/index.ts",
  "types": "dist/index.d.ts",
  "scripts": {
    "build": "parcel build"
  },
  "devDependencies": {
    "@parcel/packager-ts": "^2.0.1",
    "@parcel/transformer-typescript-types": "^2.0.1",
    "parcel": "^2.0.1",
    "typescript": "4.4.4"
  }
}

馃 Expected Behavior

After running npm install and npm build, file dist/index.d.ts should look maybe something like this?

declare global { }
declare class Foo {
}
export const foo: Foo;

馃槸 Current Behavior

Ouput definition file is completely empty.

馃捇 Code Sample

Sample repo

@jakubmazanec jakubmazanec changed the title Parcel 2 generates wrong declaratino files when declare global is used Parcel 2 generates wrong declaration file when declare global is used Dec 16, 2021
@Shinyaigeek
Copy link
Contributor

Shinyaigeek commented Dec 17, 2021

This issue seems to be fixed in #7315 馃憖 current v2 branch correctly works.

@mischnic
Copy link
Member

Indeed, it also works fine with the nightly versions.

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