In my TypeScript project, I am utilizing Moment.js for dealing with datetime objects. As part of this, I wish to create an object type that includes a key holding a value of type Moment
.
However, upon adding the following snippet to a global definition file named test.d.ts
, none of the interfaces defined within that file can be located anywhere in the project.
import { Moment } from 'moment';
interface Test {
date: Moment;
}
Whenever I attempt to utilize this interface in either a .ts
or .tsx
file, a TypeScript error is triggered:
[at-loader] ./src/<examplefilename>.tsx:91:26
TS2304: Cannot find name 'Test'.
Despite no issues being flagged by VSCode's TypeScript error checking or TSLint, the problem persists.
What steps should I take to import a type from an external module for utilization in a global definition file?