Issue
I am unable to import xml file in tsx file, but in jsx file i can able to access that xml file
Solution
You need to define a module for typescript to evaluate, otherwise it will try to look for something like toolbox.xml.ts
.
Something along these lines in a file called XML.d.ts (for this placed in a folder @types in src):
declare module "*.xml" {
const doc: any; // Change this to an actual XML type
export default doc;
}
and add "typeRoots": ["src/@types", "node_modules/@types"]
to your tsconfig.json (this makes typescript pick up the new typings file along with all installed types).
Answered By - Elias Schablowski
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.