hi i have a react project created with vite, i use typescript, this is my…
- User
hi i have a react project created with vite, i use typescript, this is my tsconfig.app.json file :
{ "compilerOptions": { "incremental": true, "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo", "target": "ES2020", "useDefineForClassFields": true, "lib": ["ES2020", "DOM", "DOM.Iterable"], "module": "ESNext", "skipLibCheck": true, "moduleResolution": "bundler", "allowImportingTsExtensions": true, "isolatedModules": true, "moduleDetection": "force", "noEmit": true, "jsx": "react-jsx", "strict": true, "noUnusedLocals": true, "noUnusedParameters": true, "noFallthroughCasesInSwitch": true, "baseUrl": ".", "paths": { "@src/*": ["src/*"], "@assets": ["src/assets"], "@common": ["src/common"], "@components": ["src/components"], "@constants": ["src/constants"], "@context": ["src/context"], "@hooks": ["src/hooks"], "@imports": ["src/imports"], "@layout": ["src/layout"], "@pages": ["src/pages"], "@services": ["src/services"], "@styles": ["src/styles"], "@theme": ["src/theme"], "@utils": ["src/utils"], "@public": ["public"] } }, "include": ["src/**/*", "public/**/*"] }when i run command npm run build i get this kind of erros:
src/utils/stringUtils.ts:1:26 - error TS7016: Could not find a declaration file for module '@imports'. 1 import { CryptoJS } from "@imports";so i want turn off this kind of error or fix it , because i import my things first into src/imports/index.js and its working fine but i get error, how can i fix it?
- Assistant
- User
my exported thing are so much , i can write this for every one of those:
// src/types/imports.d.ts declare module '@imports' { export const CryptoJS: any; // Adjust the type based on what is being exported // Add other exports from your module if necessary } - Assistant
- User
how i do "Strategy 4: Use tsconfig to Include All .d.ts files" this?
- Assistant