microsoft / microsoft/TypeScript

bug of multi re-export with interface

Open
#38,937 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Needs Investigation
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

TypeScript Version: 3.7.x-dev.201xxxxx

Search Terms:

Code

export interface IOptions
{
	/**
	 * 忽略的字 or 任何支援 indexOf 的 Object
	 */
	skip?,
	/**
	 * safe mode
	 */
	safe?: boolean,
}
export { zh2jp, zht2jp, zhs2jp, zhs2zht, zht2zhs, cjk2zhs, jp2zhs, jp2zht, cjk2zht, cjk2jp, IOptions } from './core';

Expected behavior:

Object.defineProperty(exports, "__esModule", { value: true });
var core_1 = require("./core");
Object.defineProperty(exports, "zh2jp", { enumerable: true, get: function () { return core_1.zh2jp; } });
Object.defineProperty(exports, "zht2jp", { enumerable: true, get: function () { return core_1.zht2jp; } });
Object.defineProperty(exports, "zhs2jp", { enumerable: true, get: function () { return core_1.zhs2jp; } });
Object.defineProperty(exports, "zhs2zht", { enumerable: true, get: function () { return core_1.zhs2zht; } });
Object.defineProperty(exports, "zht2zhs", { enumerable: true, get: function () { return core_1.zht2zhs; } });
Object.defineProperty(exports, "cjk2zhs", { enumerable: true, get: function () { return core_1.cjk2zhs; } });
Object.defineProperty(exports, "jp2zhs", { enumerable: true, get: function () { return core_1.jp2zhs; } });
Object.defineProperty(exports, "jp2zht", { enumerable: true, get: function () { return core_1.jp2zht; } });
Object.defineProperty(exports, "cjk2zht", { enumerable: true, get: function () { return core_1.cjk2zht; } });
Object.defineProperty(exports, "cjk2jp", { enumerable: true, get: function () { return core_1.cjk2jp; } });

Actual behavior:

the (last) will emit wrong js code in Version 4.0.0-dev.20200601

this bug happen in super low chance

***************
*** 11,18 ****
--- 11,19 ----
  Object.defineProperty(exports, "zht2zhs", { enumerable: true, get: function () { return core_1.zht2zhs; } });
  Object.defineProperty(exports, "cjk2zhs", { enumerable: true, get: function () { return core_1.cjk2zhs; } });
  Object.defineProperty(exports, "jp2zhs", { enumerable: true, get: function () { return core_1.jp2zhs; } });
  Object.defineProperty(exports, "jp2zht", { enumerable: true, get: function () { return core_1.jp2zht; } });
  Object.defineProperty(exports, "cjk2zht", { enumerable: true, get: function () { return core_1.cjk2zht; } });
  Object.defineProperty(exports, "cjk2jp", { enumerable: true, get: function () { return core_1.cjk2jp; } });
+ Object.defineProperty(exports, "IOptions", { enumerable: true, get: function () { return core_1.IOptions; } });
  exports.default = exports;
  //# sourceMappingURL=index.js.map

Playground Link:

Related Issues:

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 with the linked TypeScript files, especially packages/cjk-conv/lib/jp/index.ts and its re-export from ./core, then reproduce the emitted JavaScript with the reported compiler versions. Compare the output for the IOptions interface against the expected output; done means the multi re-export no longer emits an incorrect runtime export.

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
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.