I am unable to import xml file in tsx file, but in jsx file i can able to access that xml file
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).
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