1.0.5 • Published 5 years ago

marko-type-definitions v1.0.5

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

Marko Type Definitions

Language Node Version Yarn Version Licence Info

KoaJs Slack

Unofficial marko js type definitions for typescript

  • 🎉 First class Typescript support
  • 👌 Complete support for all component props & methods
  • ✨ Typings built while keeping intellisense support on all state / input objects

Table of Contents

Installation

$ npm install --save-dev marko-type-definitions

...
$ yarn add -D marko-type-definitions

...

Usage

import { Marko } from "marko-type-defintions";

/**
 * Optional typed state 
 *
 * @interface IState
 */
interface IState {
    example: boolean;
};

/**
 * Optional typed input 
 *
 * @interface IInput
 */
interface IInput {
    example: boolean;
};

class Component extends Marko.Component<IState, IInput> {

    public onCreate(input: IInput) {
        this.state = {
            example: input.example,
        };
    }

    public onMount() {
        // Do something
    }

    ...
}

export = Component;

Support

Please open an issue for support.

Contributing

Please contribute using Github Flow. Create a branch, add commits, and open a pull request.

License

MIT : http://opensource.org/licenses/MIT

Author

Jarvis Prestidge | jarvisprestidge@gmail.com