Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type definition errors #35

Open
gfmio opened this issue Jul 25, 2017 · 2 comments
Open

Type definition errors #35

gfmio opened this issue Jul 25, 2017 · 2 comments

Comments

@gfmio
Copy link

gfmio commented Jul 25, 2017

Hi! I'm just trying to get snabbdom-to-html working with TypeScript and I'm getting a bunch of error messages about the type definitions using tsc v2.4.2:

node_modules/snabbdom-to-html/type-definitions/snabbdom-to-html.d.ts(1,9): error TS2305: Module '"/Users/gfmio/projects/js/csam-new/csam/node_modules/snabbdom/snabbdom"' has no exported member 'VNode'.
node_modules/snabbdom-to-html/type-definitions/snabbdom-to-html.d.ts(9,3): error TS2666: Exports and export assignments are not permitted in module augmentations.
node_modules/snabbdom-to-html/type-definitions/snabbdom-to-html.d.ts(12,16): error TS2665: Invalid module name in augmentation. Module 'snabbdom-to-html/init' resolves to an untyped module at '/Users/gfmio/projects/js/csam-new/csam/node_modules/snabbdom-to-html/init.js', which cannot be augmented.
node_modules/snabbdom-to-html/type-definitions/snabbdom-to-html.d.ts(24,16): error TS2665: Invalid module name in augmentation. Module 'snabbdom-to-html/modules' resolves to an untyped module at '/Users/gfmio/projects/js/csam-new/csam/node_modules/snabbdom-to-html/modules/index.js', which cannot be augmented.
node_modules/snabbdom-to-html/type-definitions/snabbdom-to-html.d.ts(29,16): error TS2665: Invalid module name in augmentation. Module 'snabbdom-to-html/modules/index' resolves to an untyped module at '/Users/gfmio/projects/js/csam-new/csam/node_modules/snabbdom-to-html/modules/index.js', which cannot be augmented.
node_modules/snabbdom-to-html/type-definitions/snabbdom-to-html.d.ts(34,16): error TS2665: Invalid module name in augmentation. Module 'snabbdom-to-html/modules/attributes' resolves to an untyped module at '/Users/gfmio/projects/js/csam-new/csam/node_modules/snabbdom-to-html/modules/attributes.js', which cannot be augmented.
node_modules/snabbdom-to-html/type-definitions/snabbdom-to-html.d.ts(39,16): error TS2665: Invalid module name in augmentation. Module 'snabbdom-to-html/modules/class' resolves to an untyped module at '/Users/gfmio/projects/js/csam-new/csam/node_modules/snabbdom-to-html/modules/class.js', which cannot be augmented.
node_modules/snabbdom-to-html/type-definitions/snabbdom-to-html.d.ts(44,16): error TS2665: Invalid module name in augmentation. Module 'snabbdom-to-html/modules/props' resolves to an untyped module at '/Users/gfmio/projects/js/csam-new/csam/node_modules/snabbdom-to-html/modules/props.js', which cannot be augmented.
node_modules/snabbdom-to-html/type-definitions/snabbdom-to-html.d.ts(49,16): error TS2665: Invalid module name in augmentation. Module 'snabbdom-to-html/modules/style' resolves to an untyped module at '/Users/gfmio/projects/js/csam-new/csam/node_modules/snabbdom-to-html/modules/style.js', which cannot be augmented.

The first error can be fixed by replacing the line with import {VNode} from "snabbdom/vnode";.

The second error can be fixed by replacing the declare module "snabbdom-to-html" block with

declare module "snabbdom-to-html" {
  export function toHTML(vnode: VNode): string;
}

My linter also alerted me that the declaration of Module can be changed to export type Module = (vnode: VNode, attributes: Map<string, number | string>) => void;.

I couldn't figure out how to get rid off the other error messages (except for by deleting them) unless you move them to separate files.

Can I submit these initial fixes as a pull request? Alternatively, can I quickly rewrite the library in TypeScript? That should also solve all problems.

Cheers!

@acstll
Copy link
Member

acstll commented Nov 20, 2017

Can I submit these initial fixes as a pull request? Alternatively, can I quickly rewrite the library in TypeScript? That should also solve all problems.

sorry @gfmio somehow I missed your issue completely.

Yes, feel free to submit a PR.

Also a TypeScript rewrite has been on our radar for a long time (you can check old issues). Go ahead if you have the time.

@acstll
Copy link
Member

acstll commented Nov 20, 2017

Also, in a complete rewrite scenario, it would be great to consider suggestions and opinions from both the snabbdom and the Cycle.js communities (the @cycle/html module depends on this library). Both projects are written in TS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants