Skip to content
This repository was archived by the owner on Sep 2, 2024. It is now read-only.
This repository was archived by the owner on Sep 2, 2024. It is now read-only.

Changes to file structure to also support using Mithril globally #36

@felix-roehrich

Description

@felix-roehrich

I propose changing the file structure, so this type declaration, also supports global usage.

Benefits:

  • Only one package to maintain instead of two
  • Users do not need to create an extra types.d.ts file
  • Works out of the box, so potential beginning programmers are not scared away by having to write the types.d.ts file, and newcomers are not annoyed that it does not work [out of the box] (this is also the reason why I almost dropped Mithril; for example the Vnode in "mithril-global" has no default, which is annoying if you are working with explicit types)

Changes:

  • moved the content from index.d.ts to mithril.d.ts and created new index.d.ts
  • moved the declare functions at the beginning to the Static interface (so they are not exposed)
  • some small changes to the export statements at the end

For the new usage you can take a look at this minimal example

P.S. I am using GoLand, so some feedback on other IDEs would be appreciated, though I expect it to work anywhere.

Edit: The namespace can be renamed Mithril -> m, so you can still write m.Vnode instead of Mithril.Vnode.

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