cmorten / opine

Minimalist web framework for Deno ported from ExpressJS.
https://github.com/cmorten/opine/blob/main/.github/API/api.md
MIT License
854 stars 43 forks source link

TS2305 ERROR in deps.ts with range-parser default export #146

Closed cawoodm closed 3 years ago

cawoodm commented 3 years ago

Issue

deps.ts is importing/exporting a default where none exists in range-parsers@1.2.1:

error: TS2305 [ERROR]: Module '"https://cdn.skypack.dev/-/range-parser@v1.2.1-fjgeOUVylppNnKWgNZKr/dist=es2020,mode=types/index.d.ts"' has no exported member 'default'. export { default as parseRange } from "https://cdn.skypack.dev/range-parser@1.2.1?dts";


    at https://deno.land/x/opine@1.8.0/deps.ts:52:10

Setup:

Details

It's weird because this code works on a different machine just fine.

tiloio commented 3 years ago

I solved this via using a tsconfig.json file with the following content:

{
    "compilerOptions": {
        "allowSyntheticDefaultImports": true
    }
}

And doing deno run --allow-env --allow-read --allow-net --config ./tsconfig.json path/to/your/file.

The reason is that "https://cdn.skypack.dev/ms@2.1.2?dts" needs it. See error message:

TS2497 [ERROR]: This module can only be referenced with ECMAScript imports/exports by turning on the 'allowSyntheticDefaultImports' flag and referencing its default export.
export { default as ms } from "https://cdn.skypack.dev/ms@2.1.2?dts";
cmorten commented 3 years ago

This issue appears to be a dupe of #144, thanks for the notes @tiloio, I’m sure that’ll come in handy!