type IActiveKey = 'http' | 'dns' | 'ping' | 'tracetroute'; interface IContext{ activeKey: IActiveKey; } const context: IContext = { activeKey: ‘http’ } 帮我更正一下这段react-ts的代码
时间: 2023-03-02 21:57:07 浏览: 257
js代码-react.js相关
Sure, here's the corrected React-TS code:
```
type IActiveKey = 'http' | 'dns' | 'ping' | 'traceroute';
interface IContext {
activeKey: IActiveKey;
}
const context: IContext = {
activeKey: 'http'
};
```
The correction includes:
- Fixing the quotation marks around the string value for `activeKey` to use straight single or double quotes (`'` or `"`), as opposed to curly quotes (`‘` or `’`).
- Correcting the spelling of `traceroute` to `traceroute` in the type definition for `IActiveKey`.
阅读全文