Microsoft 的 C/C++ 扩展已安装,一切运行良好。但当出现问题时,VSCode 似乎不会显示任何语法错误的红色下划线。
我正在使用预装了 g++ 的 Linux (kubuntu)。我还可以成功构建我的代码并运行它。
关于如何解决这个问题有什么建议吗?
当我尝试在 TS 中使用 React-hook-form 构建 React 应用程序时,出现以下错误:
node_modules/react-hook-form/dist/types/utils.d.ts:24:77 - error TS1005: '?' expected.
24 declare type PathImpl<K extends string | number, V> = V extends Primitive ? `${K}` : `${K}` | `${K}.${Path<V>}`;
~~~
node_modules/react-hook-form/dist/types/utils.d.ts:24:84 - error TS1005: ';' expected.
24 declare type PathImpl<K extends string | number, V> = V extends Primitive ? `${K}` : `${K}` | `${K}.${Path<V>}`;
~
node_modules/react-hook-form/dist/types/utils.d.ts:24:110 - error TS1005: '(' expected.
24 declare type PathImpl<K extends string | number, V> = V extends Primitive ? `${K}` …
Run Code Online (Sandbox Code Playgroud) 错误说“元素类型无效:需要一个字符串(对于内置组件)或一个类/函数(对于复合组件)但得到:未定义。您可能忘记从它定义的文件中导出您的组件。检查的渲染方法Route
。”
代码如下所示:
import { CSSTransitionGroup } from 'react-transition-group'
import React, { Component } from 'react';
export default class TodoList extends React.Component {
constructor(props) {
super(props);
this.state = {items: ['hello', 'world', 'click', 'me']};
this.handleAdd = this.handleAdd.bind(this);
}
handleAdd() {
const newItems = this.state.items.concat([
prompt('Enter some text')
]);
this.setState({items: newItems});
}
handleRemove(i) {
let newItems = this.state.items.slice();
newItems.splice(i, 1);
this.setState({items: newItems});
}
render() {
const items = this.state.items.map((item, i) => (
<div key={item} onClick={() => this.handleRemove(i)}>
{item}
</div>
));
return …
Run Code Online (Sandbox Code Playgroud)