Sumanth Rao
Sumanth Rao

Reputation: 59

Converting a JavaScript(JS) file to TypeScript Definition file (.d.ts)

I'm trying to convert the foundation.js file to typescript to use it in my project. I tried using the command

tsc -d foundation.ts --out foundation.js and alternatively tsc -d foundation.d.ts --out foundation.js

I'm getting an error. "error TS5007: Cannot resolve referenced file: 'foundation.ts'."

Anyone solutions for this? or any other alternative to convert a .js to .d.ts file?

Upvotes: 0

Views: 1703

Answers (1)

Brocco
Brocco

Reputation: 64883

There is no need to create your own, there is one already created in the definitely typed repo... https://github.com/borisyankov/DefinitelyTyped/tree/master/foundation

You can get it multiple ways:

  • clone the repo
  • download the repo
  • use tsd *recommended
  • use nuget (if you're using visual studio)

Upvotes: 1

Related Questions