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

TypeScript types definition #21

Open
ovonkahle opened this issue Feb 22, 2018 · 4 comments
Open

TypeScript types definition #21

ovonkahle opened this issue Feb 22, 2018 · 4 comments

Comments

@ovonkahle
Copy link

Using React with TypeScript (TSX) requires type definitions for node modules. Are there plans to release TypeScript definition (*.d.ts) for this module?

@jberube
Copy link

jberube commented Mar 19, 2018

Would you accept a PR if I provide one to include the *.d.ts file in this project?

@pbirsinger
Copy link

Get us out of the stone ages here!

@sodle
Copy link

sodle commented May 27, 2019

Here's a quick and dirty set of typedefs. Enough to make VSCode stop screaming about missing types, at least.
https://gist.github.com/sodle/1173508af207a6bc277e8f3102f823de

@emasys
Copy link

emasys commented Jan 23, 2020

An easy fix for a CRA project using @sodle's solution.
create a .d.ts file, then add typings below into it and restart your server.

declare interface IScriptProps {
  attributes?: object;
  onCreate?: () => void;
  onError?: () => void;
  onLoad: () => void;
  url: string;
}
declare class Script {
  props: IScriptProps;
  state: any;
  context: any;
  refs: any;
  forceUpdate(callback: any): void;
  render(): any;
  setState(partialState: any, callback: any): void;
}

declare module 'react-load-script' {
  export = Script;
}

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

5 participants