我有一个Jest测试文件,其中包含一个简单的导入一个TSX组件在我的nextjs 13站点。
“'Properties'引用了一个值,但在这里被用作类型。您的意思是'typeof Properties'吗?ts(2749)”
进口本身表明
"声明了“Properties”,但从不读取其值。ts(6133)“
然而,当它在没有语法的情况下传递时,即打开和关闭< />时,属性导入突然被使用和识别。导入本身显示了一个类型脚本JSX.元素的签名,所以它看起来是正确的。这可能是什么原因呢?
import { render, screen } from '@testing-library/react'
import Properties from "../src/app/[locale]/properties/page"
import '@testing-library/jest-dom'
describe("PropertiesPage", () => {
it("renders a results page", () => {
const meme = render(<Properties/>) // < fails to recognise import
})
})
字符串
1条答案
按热度按时间sshcrbum1#
原来我只是一个白痴,我标记的文件为ts而不是tsx