denoland / denoland/website_feedback

deno.land/x/ package docs: using `import { type default }` with `const` is incorrect and confusing

Open
#53 1 comment 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

See https://github.com/openai/openai-node/issues/477

The docs here: https://deno.land/x/openai@v4.16.1/mod.ts?s=default.ChatCompletion

recommend this code:

```ts
import { type default } from "https://deno.land/x/openai@v4.16.1/mod.ts";
const { ChatCompletion } = default;
```
which cause this error:
```
Identifier expected.
```

The code should instead be this:

```ts
import type OpenAI from "https://deno.land/x/openai@v4.16.1/mod.ts";
type ChatCompletion = OpenAI.ChatCompletion
```

Which involves a few changes:

1. Use the name of the thing that is exported instead of `default` when possible
2. don't use `const` for a type

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.