microsoft / microsoft/TypeScript

Playground typing issue

Open
#63,334 1 comment 0 reactions 0 assignees View on GitHub
Website
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

### 🔎 Search Terms

TypeScript Playground error when attempting to import something from `@octokit/core/types`

### 🕗 Version & Regression Information

Seems irrelavent to TS version

### ⏯ Playground Link

https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAKjgQwM5wPIGMYQNbAwAqAnmAKboBmUEIcA5AAIQ76ED0W05HMZlBgCghoSLDgBvTGwLwAvnBp1GrXHIYBuEdwB2qeAHNCACwCuAIzgBeOLvIB3GesIAKAJTah5AB7j4egbO7MQCqF6+-nD8FMFypLG2MeQQVHDGMOYW2kA

### 💻 Code

```ts
import * as OctokitTypes from '@octokit/core/types';
```

### 🙁 Actual behavior

**Behavior 1**:

Type of the following variable is recognized as `any`:
```ts
import { Octokit } from 'octokit';
export type T = typeof Octokit;
```

**Behavior 2**:

Type of the following variable is recognized as `any`;
```ts
import * as OctokitTypes from '@octokit/core/types';
export const OctokitTypes;
```

**Behavior 3**: _Even stranger behavior_

In the following code snippet:
```ts
import * as OctokitTypes from '@octokit/core/types';
```

1. Remove any character from package name `@octokit/core/types` (e.g. `@octokit/core/type`), TS error occured, which is expected
Image
2. Re-add the removed character, TS error remained, which is very weird
Image
Apparently there is some problem with the language server, as the package name has been changed to `*/types`, but it still reports error of `*/type`

### 🙂 Expected behavior

N/A

### Additional information about the issue

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the three behaviors in the linked TypeScript Playground, focusing on the @octokit/core/types import and the stale diagnostic after editing the package name. Trace the relevant module-resolution or language-server behavior; done means the valid import is resolved with its actual types and diagnostics update after the edit.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.