snabbdom-pragma icon indicating copy to clipboard operation
snabbdom-pragma copied to clipboard

'No default export' error with TypeScript

Open mrehayden1 opened this issue 7 years ago • 1 comments

When importing snabbdom-pragma like so into my project

import Snabbdom from 'snabbdom-pragma';

TypeScript throws the following error

TS1192: Module '"<snip>/snabbdom-pragma/snabbdom-pragma"' has no default export.

The only way to get it to compile without errors is as a qualified import, which is a bit warty.

import * as Snabbdom from 'snabbdom-pragma';

My tsconfig.json:

{
  "compilerOptions": {
    "allowJs": true,
    "jsx": "React",
    "jsxFactory": "Snabbdom.createElement",
    "module": "es6",
    "moduleResolution": "node",
    "noImplicitAny": true,
    "outDir": "www/js",
    "sourceMap": true,
    "strict": true,
    "target": "es5"
  },
  "exclude": [ "node_modules" ]
}

mrehayden1 avatar Aug 10 '18 08:08 mrehayden1

(Back in business after a break)

I am pretty sure it is because I use an old way to define default export in the DTS file. I was not so confident about Typescript when I was working on this projet.

I will take a look shorty.

Thank you for the report.

Swizz avatar Aug 16 '18 08:08 Swizz