microsoft / microsoft/TypeScript

Module AMD and outFile causes declaration emit to use module that does not exist

Open
#37,267 2 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.5.1, 3.7.5, 3.8.3

Search Terms: module, amd, outFile, declaration emit

Code

git clone https://github.com/AnyhowStep/tsql.git
cd tsql
git checkout e5a0d16ac31d868f03386b4381e51eed5f6c731d
npm install
./node_modules/.bin/tsc -m amd --outFile test-amd.js
  1. You should now see a test-amd.d.ts file.
  2. Open test-amd.d.ts with VS code or something.
  3. Set VS code to use the TypeScript version in node_modules (3.5.1)
  4. Ctrl+F > const concat:

You will see this,
image

Cannot find module 'expr-library/factory'.ts(2307)

That module, indeed, does not exist.

In fact, it is looking for import("expr-library/factory/make-operator-1-to-n").Operator1ToN but is looking at the wrong module.

There are many other places where it references "expr-library/factory", which does not exist.

Expected behavior:

emitted .d.ts should either use import("expr-library/factory/make-operator-1-to-n").Operator1ToN or emit a "expr-library/factory" module

Actual behavior:

Emit uses "expr-library/factory", it does not exist

Playground Link: None

Related Issues: None

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

Clone the tsql repository at commit e5a0d16ac31d868f03386b4381e51eed5f6c731d, install dependencies, and run the provided tsc command with AMD and outFile. Inspect test-amd.d.ts around the concat declaration and its expr-library/factory references. Done means declaration emit references the existing make-operator-1-to-n module or emits a matching expr-library/factory module without unresolved-module errors.

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
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.