Skip to content

Type definition errors #35

@gfmio

Description

@gfmio

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions