Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

TypeScript syntax incorrectly used in JavaScript file #3935

Closed
@dancingfrog

Description

@dancingfrog
  • Version:
    0.11.1

  • Platform:
    Linux localhost.localdomain 5.8.15-301.fc33.x86_64 (Fedora 33)

  • Subsystem:

Severity:

Medium

Description:

Initially I read this as a typo on line 75 of packages/ipfs-http-gateway/src/index.js :

const gatewayAddrs = addresses?.Gateway || []

,.. and tried to correct this with pull request #3918
Through discussion on that request, it now appears that the author attempted to use valid TypeScript syntax within a JavaScript file. This is not valid JavaScript syntax and this code will throw an error in certain contexts.

Steps to reproduce the error:

The simplest way to reproduce this error is to install ipfs in a project using npm and then run:

$ node node_modules/.bin/jsipfs
(node:28639) ExperimentalWarning: The ESM module loader is experimental.
file:///home/revlin/Public/node_modules/ipfs-http-gateway/esm/src/index.js:44
    const gatewayAddrs = addresses?.Gateway || [];
                                   ^

SyntaxError: Unexpected token '.'
    at Loader.moduleStrategy (internal/modules/esm/translators.js:117:18)

Metadata

Metadata

Assignees

No one assigned

    Labels

    need/triageNeeds initial labeling and prioritization

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions