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

"Is not a module" error caused by Typescript #20

Open
idelice opened this issue Jan 5, 2022 · 6 comments
Open

"Is not a module" error caused by Typescript #20

idelice opened this issue Jan 5, 2022 · 6 comments

Comments

@idelice
Copy link

idelice commented Jan 5, 2022

I installed this library with Yarn 2 PnP and it gave me an error when i try to import:

import * as JSURL from 'jsurl'

Error: File 'PROJECT_PATH/.yarn/cache/@types-jsurl-npm-1.2.30-5763667407-c51ff0d159.zip/node_modules/@types/jsurl/index.d.ts' is not a module.ts(2306)

@williamkunz
Copy link

Just ran into this: @types/jsurl is typing for a different repo altogether

@Roreo
Copy link

Roreo commented Feb 3, 2022

Having the same issue as @williamkunz when trying to install @types/jsurl any update on this?

Edit: oh man. Last commit was 2016. Well maybe time to find another solution...

@Psiphonc
Copy link

Adding jsurl.d.ts under the src/types folder with the following declaration solves the problem for me

declare module "jsurl" {
  type Nullable<T> = T | null | undefined;
  export function stringify(input: any): string;
  export function parse(input?: Nullable<string>): Nullable<any>;
}

@pxwise
Copy link

pxwise commented Jul 12, 2022

Churned a couple hours on this. How can we get the @types/jsurl package be taken down / replaced?

@Dragomir-Ivanov
Copy link

@Psiphonc No tryParse declaration.

declare module "jsurl" {
  type Nullable<T> = T | null | undefined
  export function stringify(input: any): string
  export function parse(input?: Nullable<string>): Nullable<any>
  export function tryParse(input?: Nullable<string>, def?: any): Nullable<any>
}

@asherccohen
Copy link

still an issue in "@types/jsurl": "^1.2.30",

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

No branches or pull requests

7 participants