microsoft / microsoft/TypeScript

Playground typing issue

Open
#63,334 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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
import * as OctokitTypes from '@octokit/core/types';
🙁 Actual behavior

Behavior 1:

Type of the following variable is recognized as any:

import { Octokit } from 'octokit';
export type T = typeof Octokit;

Behavior 2:

Type of the following variable is recognized as any;

import * as OctokitTypes from '@octokit/core/types';
export const OctokitTypes;

Behavior 3: Even stranger behavior

In the following code snippet:

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

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

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.