Closed adrianiskandar closed 2 years ago
Hi, so that issue is easy to fix if you add a custom.d.ts file with this information:
custom.d.ts
declare module '*.svg' { const content: string; export default content; }
And then you add custom.d.ts file to the "include" array in tsconfig.json:
tsconfig.json
{ "include": ["custom.d.ts", "**/*.ts", "**/*.tsx"], "compilerOptions": { "moduleResolution": "node", ...other options }, "noEmit": true } }
However, looks like tsc-files temp config files is DELETING everything inside the include array, when it runs it creates something like this:
{ "include": [], "compilerOptions": { "lib": [ "DOM", "DOM.Iterable", "ES2019" ], "isolatedModules": true, "esModuleInterop": true, "jsx": "react-jsx", "moduleResolution": "node", "resolveJsonModule": true, "target": "ES2019", "strict": true, "baseUrl": ".", "paths": { "~/*": [ "./app/*" ] }, "noEmit": true, "skipLibCheck": true }, "files": [ "app/components/staged.component.tsx" ] }
So when you import .svg or .css or any other type of file that needs declaration in the custom.d.ts file it fails. Do you know how we can work around this? or can we pass specific files we don't want to delete from the include array?
Thanks!
Same as https://github.com/gustavopch/tsc-files/issues/20. You can call tsc-files custom.d.ts my-file.ts as suggested here https://github.com/gustavopch/tsc-files/issues/20#issuecomment-996124875.
tsc-files custom.d.ts my-file.ts
Hi, so that issue is easy to fix if you add a
custom.d.ts
file with this information:And then you add
custom.d.ts
file to the "include" array intsconfig.json
:However, looks like tsc-files temp config files is DELETING everything inside the include array, when it runs it creates something like this:
So when you import .svg or .css or any other type of file that needs declaration in the custom.d.ts file it fails. Do you know how we can work around this? or can we pass specific files we don't want to delete from the include array?
Thanks!