|
|
安静的饭盒 · 使用 Python 3 编写系列实用脚本 - 知乎· 2 年前 · |
|
|
风度翩翩的麦片 · Python ...· 2 年前 · |
|
|
坏坏的斑马 · 本地部署运行中文 LLaMA 模型 - 哔哩哔哩· 2 年前 · |
我正在使用typescript编写redux应用程序。
var item = React.createClass({
render: function() {
return (hello world)
export default class ItemList extends Component {
render() {
return ()
}
然后typescript会抱怨:
Property 'item' does not exist on type 'JSX.IntrinsicElements'.
组件必须以大写字母开头
而不是小写字母
否则TypeScript会大喊大叫的。改变
至
应该解决这个问题:
var Item = React.createClass({
render: function() {
return (hello world)
export default class ItemList extends Component {
render() {
return ()
}
您可以像这样声明您的自定义元素类型:
import * as React from 'react'
declare global {
namespace JSX {
interface IntrinsicElements {
item: React.DetailedHTMLProps, HTMLElement>;
}