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を初めて使っています。ここにはおそらく複数のエラーがあります。