Skip to content

Fix relative paths in declaration emit for commonjs imports with trailing property access #40986

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

Merged
merged 1 commit into from
Oct 9, 2020

Conversation

sandersn
Copy link
Member

@sandersn sandersn commented Oct 7, 2020

const x = require('./foo').y

was incorrectly using the unmangled require path as the temp name in
emit:

import ./foo_1 = require('./foo')
import x = ./foo_1.y

It now uses the imported identifier:

import x_1 = require('./foo')
import x = x_1.y

Discovered while fixing #37832

```js
const x = require('./foo').y
```

was incorrectly using the unmangled require path as the temp name in
emit:

```
import ./foo_1 = require('./foo')
import x = ./foo_1.y
```

It now uses the imported identifier:

```
import x_1 = require('./foo')
import x = x_1.y
```

Discovered while fixing #37832
@typescript-bot typescript-bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Oct 7, 2020
@sandersn sandersn changed the title Fix relative paths in commonjs decl emit w/property access Fix relative paths in declaration emit for commonjs imports with trailing property access Oct 7, 2020
@sandersn sandersn merged commit a109b5d into master Oct 9, 2020
@sandersn sandersn deleted the fix-relative-paths-in-commonjs-decl-emit branch October 9, 2020 23:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants