microsoft / microsoft/TypeScript

`@type {const}` produces namespace in .d.ts instead of normal object type

オープン
#56,789 コメント 6 件 リアクション 0 件 担当者 1 名 GitHub で見る

@sandersn がすでに取り組んでいます。

2023年12月22日 から。

Bug Domain: JSDoc Rescheduled
主要言語
Go
スター
111k
フォーク
14.4k
平均マージ
1日 19時間
マージ済み PR(30日)
117

説明

🔎 Search Terms

@type {const}
const
definition types

🕗 Version & Regression Information
  • This is a crash in all versions
⏯ Playground Link

https://www.typescriptlang.org/play?target=99&jsx=0&ts=5.3.2&filetype=ts#code/KYDwDg9gTgLgBAYwgOwM7wLYE8DCL1wC8cA9AFRlwACMWYwcA3kmjAL5xklMCwAUAEgAZhAgAuOAHIARgEMokgDT9hAV1UTGK4aIkz5klW35sA3PyA

💻 Code
// Typescript file
export const myConst = /** @type {const} */ {
	foo: 'bar',
	fuu: {
		foo: 'bar'
	}
};
// Javascript file
export const myConst = /** @type {const} */ {
	foo: 'bar',
	fuu: {
		foo: 'bar'
	}
};
🙁 Actual behavior
// .D.TS from Typescript file
export declare const myConst: {
    foo: string;
    fuu: {
        foo: string;
    };
};
// .D.TS from Javascript file
export namespace myConst {
    let foo: string;
    namespace fuu {
        let foo_1: string;
        export { foo_1 as foo };
    }
}
🙂 Expected behavior

Same output in both cases. Typescript file output is the correct one.

Additional information about the issue

No response

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。