@types/idyll-compiler
TypeScript icon, indicating that this package has built-in type declarations

3.1.6 • Public • Published

Installation

npm install --save @types/idyll-compiler

Summary

This package contains type definitions for idyll-compiler (https://github.com/idyll-lang/idyll/tree/master/packages/idyll-compiler).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/idyll-compiler.

index.d.ts

declare namespace compiler {
    type PropType = "variable" | "value" | "expression";
    type PropData = string | number | boolean;
    type PropKey = string;
    type PropValue = [PropType, PropData];
    type Property = [PropKey, PropValue];
    type __RecursiveNode<T> = [string, Property[], T[]];
    interface TreeNode extends __RecursiveNode<Node> {}
    type Node = TreeNode | string;
    type AST = Node[];

    type PostProcessor =
        | ((ast: AST) => AST)
        | ((ast: AST, callback: (err: any, value: AST) => void) => void);

    interface Options {
        spellcheck?: boolean | undefined;

        smartquotes?: boolean | undefined;

        /**
         * If false and there is no postprocessors, compiler returns the AST synchronously
         * Otherwise, a promise is returned
         */
        async?: boolean | undefined;

        /**
         * compiler plugins
         * If provided, compiler always compiles asynchronously
         */
        postProcessors?: PostProcessor[] | undefined;
    }
}

/**
 * Compiles the given idyllMarkup and returns an AST either synchronously
 * or asynchronously.
 *
 * If postProcessors are provided or options.async is set to true:
 *      compiler returns a promise
 * Otherwise, compile returns the AST synchronously
 */
declare function compiler(
    input: string,
    options?: compiler.Options,
    callback?: () => void,
): Promise<compiler.AST> | compiler.AST;

export = compiler;

Additional Details

  • Last updated: Tue, 07 Nov 2023 03:09:37 GMT
  • Dependencies: none

Credits

These definitions were written by Thanh Ngo.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/idyll-compiler

Weekly Downloads

3

Version

3.1.6

License

MIT

Unpacked Size

5.51 kB

Total Files

5

Last publish

Collaborators

  • types