0
나는 react와 함께 typescript를 사용하고 있으며 react-sticky
이라는 타사 라이브러리에 타이핑을 제공해야합니다. 타이핑 모듈을 게시하고 싶지는 않습니다. 타이핑을 작성하여 코드베이스에 포함시키고 싶지만 문제가 있습니다. 여기에 설치Typescript '선언 파일이있는 모듈을 찾을 수 없습니다'
App.tsx
/// <reference path="./typings/index.d.ts" />
/// <reference path="./typings/react-sticky.d.ts" />
import * as React from "react"
import { Sticky, StickyContainer } from "react-sticky"
const App: React.StatelessComponent<{}> =() => {
return <StickyContainer>
<Sticky>
<h1>Hello World</h1>
</Sticky>
</StickyContainer>
}
/typings/react-sticky.d.ts
/// <reference path="./modules/react/index.d.ts" />
import * as React from "react"
declare module "react-sticky" {
export var StickyContainer: React.Component<{}, {}>
export interface StickyProps {
stickyStyle?: any
stickyClassName?: string
topOffset?: number
bottomOffset?: number
className?: string
style?: {}
onStickyStateChange?:() => void
isActive?: boolean
}
export var Sticky: React.Component<StickyProps, {}>
}
typings/index.d.ts
/// <reference path="modules/react-dom/index.d.ts" />
/// <reference path="modules/react/index.d.ts" />
/// <reference path="react-sticky.d.ts" />
내가 갖는 오류는 다음과
가요App.tsx(3,41): error TS2307: Cannot find module 'react-sticky'.
이제 Typescript를 처음 접했고 여기에 여러 가지 오류가있을 수 있습니다. 누구든지 내가해야 할 일을 알고 있습니까?