GoogleChromeLabs / GoogleChromeLabs/native-url

fix: url.d.ts is not a module

Open
#58 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
286
Forks
11
PR merge metrics
No merged PRs in 30d

Description

I got this error on tsc compiler when compiling my application:

```bash
- error TS2306: File '/xxx/node_modules/native-url/third_party/url.d.ts' is not a module.

23 import url from 'native-url'
```

Here is the diff that solved my problem:

```diff
diff --git a/node_modules/native-url/third_party/url.d.ts b/node_modules/native-url/third_party/url.d.ts
index ced41a3..b745f83 100644
--- a/node_modules/native-url/third_party/url.d.ts
+++ b/node_modules/native-url/third_party/url.d.ts
@@ -141,3 +141,5 @@ declare module 'url' {
[Symbol.iterator](): IterableIterator<[string, string]>;
}
}
+
+export default url;
\ No newline at end of file
```

Contributor guide

Open the contributing guide

Research direction

Inspect third_party/url.d.ts and reproduce the reported TypeScript compilation error with an import from native-url. Verify the declaration is recognized as a module and that the example application compiles without TS2306.

Written by the indexing model from the issue text.

Assessment

Tech stack
nodejs, typescript
Domain
backend
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.