Skip to content

Conversation

ProdigySim
Copy link
Contributor

This pattern is valid typescript, but import/named can't find resolve the imports. Relevant issue: #1984

Here's a demo showing that it should work in TS

Test fails with

  1) TypeScript named [TypeScript] valid import { FooBar } from './typescript-export-assign-object':

      AssertionError [ERR_ASSERTION] [ERR_ASSERTION]: Should have no errors but had 1: [
  {
    ruleId: 'named [TypeScript]',
    severity: 1,
    message: "FooBar not found in './typescript-export-assign-object'",
    line: 1,
    column: 10,
    nodeType: 'Identifier',
    endLine: 1,
    endColumn: 16
  }
]
      + expected - actual

      -1
      +0

Reopened from #2428

@codecov
Copy link

codecov bot commented Apr 20, 2022

Codecov Report

Merging #2432 (a8781f7) into main (116af31) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main    #2432   +/-   ##
=======================================
  Coverage   95.17%   95.17%           
=======================================
  Files          66       66           
  Lines        2799     2799           
  Branches      940      940           
=======================================
  Hits         2664     2664           
  Misses        135      135           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@ljharb
Copy link
Member

ljharb commented Aug 25, 2022

I've rebased this, and looking over it, it's actually correct - export = syntax creates only a default export, at least when esModuleInterop is on (without which, TS's module system is broken anyways). You can't named-import from a module that uses that.

@ljharb ljharb force-pushed the test-assign-object-ts branch 2 times, most recently from b9f8d49 to 33310ca Compare August 25, 2022 21:11
@ljharb ljharb force-pushed the test-assign-object-ts branch from 33310ca to a8781f7 Compare August 25, 2022 21:12
@ljharb ljharb merged commit a8781f7 into import-js:main Aug 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants