return FALSE; $r = well_tag_thread__update(array('id' => $id), $update); return $r; } function well_tag_thread_find($tagid, $page, $pagesize) { $arr = well_tag_thread__find(array('tagid' => $tagid), array('id' => -1), $page, $pagesize); return $arr; } function well_tag_thread_find_by_tid($tid, $page, $pagesize) { $arr = well_tag_thread__find(array('tid' => $tid), array(), $page, $pagesize); return $arr; } ?>reactjs - Why isn't my IDE recognizing TypeScript errors? - Stack Overflow
最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

reactjs - Why isn't my IDE recognizing TypeScript errors? - Stack Overflow

programmeradmin2浏览0评论

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:

  1. A complaint about passing in a number to a prop that should be an object with a property called val of type string.

  2. 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.

发布评论

评论列表(0)

  1. 暂无评论