Skip to content

[1.0.2 regression] TypeScript error TS2306: File '…/source-map.d.ts' is not a module #24

Closed

Description

@andersk
$ npm i source-map@npm:[email protected] typescript

added 2 packages in 2s

$ echo 'import * as SourceMap from "source-map"' > test.ts

$ npx tsc test.ts 
test.ts:1:28 - error TS2306: File '/tmp/node_modules/source-map/source-map.d.ts' is not a module.

1 import * as SourceMap from "source-map"
                             ~~~~~~~~~~~~


Found 1 error in test.ts:1

This worked in 1.0.1 and regressed in 1.0.2. I explained the reason at #13 (review): the declare module syntax is only for stubbing third-party modules. To declare modules in the current package, you should just write a separate .d.ts file for each .js file.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions