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

Type declaration #20

Open
mindplay-dk opened this issue Dec 13, 2021 · 0 comments
Open

Type declaration #20

mindplay-dk opened this issue Dec 13, 2021 · 0 comments

Comments

@mindplay-dk
Copy link

Hi,

There's no third-party types available for this package, so I had to add my own:

declare module "serialize-to-js" {
  export = serialize;

  function serialize(source: any, options?: { ignoreCircular?: boolean, reference?: boolean, unsafe?: boolean }): string;
}

I'm honestly not an expert in this area, but putting this in a serialize-to-js.d.ts file in the root of my project worked - you could probably just dump this as index.d.ts in the root folder and the package would have type-checking in TS and auto-completions in VS Code and other editors.

Cheers 🙂

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

No branches or pull requests

1 participant