Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In JSDoc @type is not a type declaration, which it is much more like type conversion. #39650

Open
leecjson opened this issue Jul 18, 2020 · 4 comments
Labels
Bug A bug in TypeScript Has Repro This issue has compiler-backed repros: https://aka.ms/ts-repros
Milestone

Comments

@leecjson
Copy link

I don't kown whether its a bug or feature.

In Javascript, actually i need an error emit which other_props is not in Entity
image

In Typescript, entityB act just same as the Javascript codes above
image

@RyanCavanaugh RyanCavanaugh added the Bug A bug in TypeScript label Jul 20, 2020
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Jul 20, 2020
@orta
Copy link
Contributor

orta commented Jul 21, 2020

Here's a repro:

// filename: index.js
// @ts-check

/** @typedef Entity
 * @property {string} prop
 */

/**
 * @type {{[key in keyof Entitiy] : any }}
 */

const e = {
    prop: 1233,
    s: ""
}

Workbench Repro

@typescript-bot typescript-bot added the Has Repro This issue has compiler-backed repros: https://aka.ms/ts-repros label Jul 21, 2020
@theGreen233
Copy link

Hello, we are a group of researchers developing machine learning techniques to locate issues suitable for newcomers, and our model considers this issue as likely a "good first issue". May we recommend you to label it as "good first issue" so newcomers know where to choose?

Thank you!

@typescript-bot
Copy link
Collaborator

typescript-bot commented Apr 14, 2022

👋 Hi, I'm the Repro bot. I can help narrow down and track compiler bugs across releases! This comment reflects the current state of this repro running against the nightly TypeScript.


Comment by @orta

👍 Compiled

Historical Information
Version Reproduction Outputs
4.2.2, 4.3.2, 4.4.2, 4.5.2, 4.6.2

👍 Compiled

@rubiesonthesky
Copy link

There is typo in @orta 's repro code as far as I can understand. Entity vs Entitiy

-  * @type {{[key in keyof Entitiy] : any }}
+  * @type {{[key in keyof Entity] : any }}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Has Repro This issue has compiler-backed repros: https://aka.ms/ts-repros
Projects
None yet
Development

No branches or pull requests

6 participants