Swizz / snabbdom-pragma

'NotReact.createElement' jsx pragma although for snabbdom
MIT License
47 stars 16 forks source link

'No default export' error with TypeScript #36

Open mrehayden1 opened 6 years ago

mrehayden1 commented 6 years ago

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" ]
}
Swizz commented 6 years ago

(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.