Is it possible to generate TypeScript declaration files from JS library?

Technology CommunityCategory: TypeScriptIs it possible to generate TypeScript declaration files from JS library?
VietMX Staff asked 3 years ago

JavaScript doesn’t always contain enough type information for the TypeScript compiler to infer the structures in your code – so automatically generating a definition based on JavaScript is rarely an option but:

  • Microsoft/dts-gen – The official starting point Microsoft uses when creating types
  • dtsmake – This one looks very promising. It depends on Ternjs which some editors use to provide autocomplete for JS code.