I have been working on the IDocumentFilingDto.ts file.
import { DocumentOrigin } from "./IDocumentFilingDto";
export interface IDocumentFilingDtoGen {
UniqueId?: any;
Title?: string;
DocumentId?: string;
Binder?: any;
CommunicationType?: any;
Origin?: DocumentOrigin;
CompanyId?: any;
DocumentCategoryId?: any;
DocumentTypeId?: any;
CompanyOriginal?: string;
SiteUrl?: string;
hasSubmitted?: boolean;
isModified?: boolean;
IsLocalOnly?: boolean;
}
Everything is functioning correctly without any type errors.
Now, I will deactivate the local DocumentOrigin interface and activate the imported DocumentOrigin.
//import { DocumentOrigin } from "./IDocumentFilingDto";
export const enum DocumentOrigin {
Original,
Kopie,
OverenaKopie,
DS,
DSSKonverzi,
Elektronicky,
}
export interface IDocumentFilingDtoGen {
UniqueId?: any;
Title?: string;
DocumentId?: string;
Binder?: any;
CommunicationType?: any;
Origin?: DocumentOrigin;
CompanyId?: any;
DocumentCategoryId?: any;
DocumentTypeId?: any;
CompanyOriginal?: string;
SiteUrl?: string;
hasSubmitted?: boolean;
isModified?: boolean;
IsLocalOnly?: boolean;
}
After this change, I am no longer utilizing the imported DocumentOrigin interface, but instead relying on the local DocumentOrigin interface. This is the only adjustment made.
Both the imported and local interfaces for DocumentOrigin are identical. However, switching to the local interface triggers an error message.
[07:20:52] Error - typescript - src\webparts\documentUploadWebPart\components\DocumentHeader\DocumentHeader.tsx(462,60): error TS2345: Argument of type '{ UniqueId?: any; Title?: string; DocumentId?: string; Binder?: any; CommunicationType?: any; Ori...' is not assignable to parameter of type 'IDocumentFilingDtoGen'. [07:20:52] Error - typescript - src\webparts\documentUploadWebPart\components\Dtos\DocumentFilingDtoGen.ts(28,12): error TS90010: Type 'DocumentOrigin' is not assignable to type 'DocumentOrigin'. Two different types with this name exist, but they are unrelated.
This behavior seems illogical. The two interfaces are identical in structure, yet one works while the other does not. Why is that?
Additional Information:
In response to a comment request, here is the code snippet from the IDocumentFilingDto.ts file as well.
export const enum DocumentOrigin {
Original,
Kopie,
OverenaKopie,
DS,
DSSKonverzi,
Elektronicky,
}
export interface IDocumentFilingDto {
UniqueId: any;
Title: string;
DocumentId: string;
Binder?: any;
CommunicationType: any;
Origin?: DocumentOrigin;
CompanyId: any;
DocumentCategoryId: any;
DocumentTypeId:any;
CompanyOriginal?: string;
SiteUrl?: string;
}