micromatch / nanomatch

Fast, minimal glob matcher for node.js. Similar to micromatch, minimatch and multimatch, but without support for extended globs (extglobs), posix brackets or braces, and with complete Bash 4.3 wildcard support: ("*", "**", and "?").
https://github.com/micromatch
MIT License
95 stars 20 forks source link

Typecript typings #21

Open G-Rath opened 5 years ago

G-Rath commented 5 years ago

I would love to use this library with TypeScript, but there don't seem to be any typings :(

hydrosquall commented 3 years ago

I started a typings file that I didn't end up needing, so I"ll share it here. Hopefully it can help someone to get started / or you can just import this into your project directly.

// nanomatch.typings.d.ts
declare module 'nanomatch' {

  interface MatchOptions {
    basename?: boolean;
    bash?: boolean;
    cache?: boolean;
    dot?: boolean;
    failglob?: boolean;
    ignore?: string | string[];
    matchBase?: boolean;
    nocase?: boolean;
    nodupes?: boolean;
    nonegate?: boolean;
    noglobstar?: boolean;
    nonull?: boolean;
    nullglob?: boolean;
    slash?: string | (() => string);
    star?: string | (() => string);
    /* https://github.com/jonschlinkert/snapdragon */
    snapdragon?: object; // a snapdragon instance:
    sourcemap?: boolean;
    unescape?: boolean;
    unixify?: boolean;
  }

  export const isMatch: (string: string, pattern: string, options?: MatchOptions) => boolean;
}