MagicMirror Forum

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • Donate
    • Discord

    Module Development in TypeScript

    Development
    2
    3
    357
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Jalibu
      Jalibu Module Developer last edited by Jalibu

      Hello developers,

      some time ago I switched all my modules to TypeScript (feel free to check out MMM-Jast as a reference implementations).
      Especially for more complex modules, TypeScript brings huge advantages from my point of view.
      Since the MagicMirror platform doesn’t provide its own TypeDefinitions, I made them available via the DefinitelyTyped library.
      For interested developers I also plan to provide some kind of TypeScript template module soon.

      .
      ├── src
      │   └── backend
      │       ├── Backend.ts
      │       ├── BackendUtils.ts
      │       └── ...
      │   └── frontend
      │       ├── Frontend.ts
      │       ├── FrontendUtils.ts
      │       └── ...
      │   └── types
      │       ├── ABC.ts
      │       └── ...
      └── templates
      │       ├── main.njk
      │       └── ...
      └── translations
      │       ├── de.json
      │       ├── en.json
      │       └── ...
      └── MMM-XYZ.js (generated)
      └── node_helper.js (generated)
      └── MMM-XYZ.css
      └── tsconfig.json
      └── rollup.config.json
      └── README.md
      └── package.json
      

      Question: Are there any other developers among you who are interested in joining my “TypeScript” initiative? A little support from another developer in maintaining the type definitions would be helpful.

      strawberry 3.141 1 Reply Last reply Reply Quote 2
      • strawberry 3.141
        strawberry 3.141 Project Sponsor Module Developer @Jalibu last edited by

        @jalibu there is a simple version of types in the main repo https://github.com/MichMich/MagicMirror/blob/master/module-types.ts

        Please create a github issue if you need help, so I can keep track

        Jalibu 1 Reply Last reply Reply Quote 0
        • Jalibu
          Jalibu Module Developer @strawberry 3.141 last edited by

          @strawberry-3-141
          as you say, it is a very simple and incomplete version. And you can not install them as a package or use them in your modules, except if you copy the file.
          In fact, that’s the real reason I created the typings on DefinitelyTyped.
          You can find the sources here and the npm module here.

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post
          Enjoying MagicMirror? Please consider a donation!
          MagicMirror created by Michael Teeuw.
          Forum managed by Paul-Vincent Roll and Rodrigo Ramírez Norambuena.
          This forum is using NodeBB as its core | Contributors
          Contact | Privacy Policy