I have a few declarations in src/types/*.d.ts
and in my src/types/role.d.ts
, I have:
declare interface Role {
id: string;
title: string;
openings: string;
jobDescriptionUrl?: string;
minCompRange: number | string;
maxCompRange: number | string;
location: string;
postCovidLocation: string;
urgency: ROLE_URGENCY;
equity: ROLE_EQUITY;
company?: Company;
color: string;
status: ROLE_STATUS;
deletedAt?: Date;
hiredAt?: Date;
createdAt: Date;
pausedAt?: Date;
managerEmail?: string;
managerName?: string;
isExcRole?: boolean;
recruiter?: Recruiter;
offer?: File;
}
Somehow, it finds the Recruiter
and File
, but Company
, which is declared in src/types/company.d.ts
:
declare interface Company {
companyName: string;
companyUrl: string;
}
doesn't get found. I get an error:
src/types/role.d.ts:14:12 - error TS2304: Cannot find name 'Company'.
14 company?: Company;
~~~~~~~
In my tsconfig.json
, I have:
"include": [
"src/**/*.ts",
]
What am I doing wrong?
For the purposes of this article, “declaration merging” means that the compiler merges two separate declarations declared with the same name into a single definition. This merged definition has the features of both of the original declarations.
TypeScript includes declaration files for all of the standardized built-in APIs available in JavaScript runtimes. This includes things like methods and properties of built-in types like string or function , top-level names like Math and Object , and their associated types.
If you paste the JavaScript into a new TypeScript file, fix any trivial errors you may get and compile it using the definition flag, it may be able to get you a file that would at least be a starting point. Show activity on this post.
try export interface Company
instead declare interface Company
maybe solved!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With