denoland / denoland/website_feedback

Specifying path to type definitions

Open
#6 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
8
Forks
1
PR merge metrics
No merged PRs in 30d

Description

```ts
import * as XLSX from 'https://deno.land/x/sheetjs@v0.18.0+deno/xlsx.mjs';

const wb = XLSX.utils.book_new();
```

Error message:

```
error: TS2339 [ERROR]: Property 'book_new' does not exist on type '{ encode_col: (col: any) => string; encode_row: (row: any) => string; encode_cell: (cell: any) => string; encode_range: (cs: any, ce: any) => any; decode_col: (colstr: any) => number; decode_row: (rowstr: any) => number; ... 20 more ...; sheet_to_row_object_array: (sheet: any, opts: any) => {}[]; }'.
```

It works when manually specifying a type file. In this case, it is `types/index.d.ts`:

```ts
// @deno-types="https://deno.land/x/sheetjs@v0.18.0+deno/types/index.d.ts"
import * as XLSX from 'https://deno.land/x/sheetjs@v0.18.0+deno/xlsx.mjs';

const wb = XLSX.utils.book_new();
```

This works with traditional node / tsc workflows because of the package.json `types` field:

```json
"types": "types/index.d.ts",
```

What settings are needed for the registry to serve the types automatically?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.