admin管理员组文章数量:1387410
I am trying to get my IDE to recognize TypeScript errors and I can't seem to figure it out. I am using:
- TypeScript 5.8.2
- Vite 6.2.1
- React 16.8
I wrote the following component to test if TypeScript was working:
//TestComp.tsx
import React from 'react';
interface IProps {
message: {val: string}
}
const TestComp = (props: IProps) => {
const val : string = 5;
return <p>{props.message}{val}</p>
};
export default TestComp;
I am rendering this component in Dashboard.jsx like so:
<TestComp message={5} />
I would expect a number of errors to appear in my IDE here:
A complaint about passing in a number to a prop that should be an object with a property called val of type string.
A complaint about assigning the number 5 to the variable 'val'
I get neither of these issue and my project renders 55 with no problems and I'm not sure why. An image of my tsconfig is attached as well. Thank you in advance.
I have tried closing VS Code and restarting it but other than ensuring TypeScript is installed I don't know what else to try. I expected it to just work after creating a component with a .tsx extension.
本文标签: reactjsWhy isn39t my IDE recognizing TypeScript errorsStack Overflow
版权声明:本文标题:reactjs - Why isn't my IDE recognizing TypeScript errors? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744495960a2609027.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论