Importing a class definition from a .ts file into a tsd.d.ts file?

105 Views Asked by At

When writing a tsd.d.ts file, I fine myself using "any" as the type for classes that I don't want to define twice: once in tsd.d.ts, and once in the class implementation file. It seems like there should be a way to import from MyClass.ts any exported classes right into the tsd.d.ts file. I tried this (based on another stack overflow answer) but when I add:

import { CRGlobals } from "../src/globals"

to my tsd.d.ts file, I get tons of compile errors in all my other files for things defined in tsd.d.ts -- as if this file no longer exists.

Do I really have to describe complex classes TWICE? Surely there must be a better way.

0

There are 0 best solutions below