medialize / medialize/URI.js

@types/urijs/index can only be default-imported using the 'allowSyntheticDefaultImports' flag

Open
#414 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
6.2k
Forks
468
PR merge metrics
No merged PRs in 30d

Description

Hello, I found an error that seems to be related to URIjs and ES6. Someone from 2016 [288] seems to have found this previously and couldnt replicate but here are the steps. Could you help me understand how to get around this?

Error: node_modules/stellar-sdk/lib/server.d.ts:2:8 - error TS1259: Module '"/node_modules/@types/urijs/index"' can only be default-imported using the 'allowSyntheticDefaultImports' flag

2 import URI from "urijs";
         ~~~

  node_modules/@types/urijs/index.d.ts:26:1
    26 export = URI;
       ~~~~~~~~~~~~~
    This module is declared with using 'export =', and can only be used with a default import when using the 'allowSyntheticDefaultImports' flag.

To replicate

  1. ng new AppName
  2. npm install --save stellar-sdk
  3. add the SDK to the app within angular.json's build scripts: ["./node_modules/stellar-sdk/dist/stellar-sdk.min.js"]
  4. run the app to see the error

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 listed Angular reproduction steps, then inspect node_modules/stellar-sdk/lib/server.d.ts and node_modules/@types/urijs/index.d.ts to trace the reported import mismatch. Done means reproducing the TS1259 error and documenting or validating a project or package-level resolution.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, javascript, typescript
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.