我有如下代码:
type ItemProps = {
status?: string;
}
<Items status={status!} /> // error here: warning Forbidden non-null assertion
// @typescript-eslint/no-non-null-
Run Code Online (Sandbox Code Playgroud)
断言
我收到禁止的非空断言错误。
我该如何修复这个错误?
我努力了
<Items status={status && status}/>
Run Code Online (Sandbox Code Playgroud)
但这似乎不正确。