-1

I have a file qux.d.ts that does:

export * from "./foo.js"
export * from "./bar.js"

If both files export State (whether type or value), how can I get TypeScript to throw an error?

NOTE: This ONLY fails to throw an error when exported via .d.ts files.

4
  • 2
    github.com/microsoft/TypeScript/issues/4527 suggests that this was implemented in 2015
    – Bergi
    Commented Apr 8 at 20:09
  • Although for types and enums, you may need to take declaration merging into account.
    – Bergi
    Commented Apr 8 at 20:12
  • @Bergi Oh wait, I have a slightly different test case. Updated my answer. Commented Apr 8 at 20:28
  • In that case, TypeScript probably only considers the type declarations, and will happily merge them if they don't conflict.
    – Bergi
    Commented Apr 8 at 20:36

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.