typescriptに型定義を配置するには
npm install @type/xxxで入れる
なにやらDefinitelyTypedというリポジトリで管理しているらしい
プルリク出したりメンテナンスが必要らしい
ローカルに入れる
For a good example package, see base64-js.
らしいので、それの型定義ファイルを例に
base64-js/index.d.tsファイル↓をつくって
code:typescript
// Type definitions for base64-js 1.2
export function byteLength(encoded: string): number;
export function toByteArray(encoded: string): Uint8Array;
export function fromByteArray(bytes: Uint8Array): string;
tsconfig.jsonにパスを入れるらしい
code:json
{
"compilerOptions": {
"baseUrl": "./",
}
}