How to disable default import if declare module has no default export?
#3586
Answered
by
RyanCavanaugh
枯萎の花 (Withered-Flower-0422)
asked this question in
Q&A
// foo.d.ts
declare module "foo" {
export const bar: () => void
// no default export
}
// test.ts
import foo from "foo" // no errorsBefore ts6.0, there's an option |
Answered by
RyanCavanaugh
Apr 24, 2026
Replies: 1 comment
|
There's not really a way to do this since we don't know from |
0 replies
Answer selected by
Withered-Flower-0422
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There's not really a way to do this since we don't know from
declare module "foo" {if it's a CommonJS or ESM module. One way you can fix that ambiguity is to addexport const __esModule: booleantodeclare module "foo", though.