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

Re-exports of multiple "declare global" statements generate incorrect declaration file #99

Closed
Septh opened this issue Jun 11, 2020 · 1 comment
Labels
Bug Something isn't working

Comments

@Septh
Copy link

Septh commented Jun 11, 2020

@wessberg/rollup-plugin-ts: 1.2.25
rollup: 2.15.0
typescript: 3.9.5

Try the following:

// src/lib/a.ts
declare global {
    const good: string
}
export const a = good
// src/lib/b.ts
declare global {
    const bad: string
}
export const b = bad
// src/index.ts
export { a } from './lib/a'
export { b } from './lib/b'

Then, the generated code is fine:

// out/index.js
const a = good;
const b = bad;
export { a, b };

But the corresponding declaration file is not:

// out/index.d.ts
declare global {
    const good: string;
}
declare const a: string;
declare global$0 {
    const bad: string;
}
declare const b: string;
export { a, b };

The second declare global should not be renamed and ideally the two statements should be merged as one.

@wessberg wessberg added the Bug Something isn't working label Jul 1, 2020
@wessberg
Copy link
Owner

wessberg commented Jul 1, 2020

Hey there. Thanks for the repro instructions. The problem has been fixed and will be released as part of v0.0.27.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants