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.