Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@lhr0909
Copy link

@lhr0909 lhr0909 commented Mar 19, 2020

在本地override通过可用 源文件如下:

/// <reference types="node" />

declare module 'enquire-js' {
  import enquire from 'enquire.js';

  // copied from @types/enquire.js
  interface Options {
      /**
       * If set to true, defers execution of the setup function until the first time the media query is matched
       */
      deferSetup?: boolean;
      /**
       * If supplied, triggered when a media query matches.
       */
      match?(): void;
      /**
       * If supplied, triggered when the media query transitions from a matched state to an unmatched state.
       */
      unmatch?(): void;
      /**
       * If supplied, triggered once, when the handler is registered.
       */
      setup?(): void;

      /**
       * If supplied, triggered when handler is unregistered. Place cleanup code here
       */
      destroy?(): void;
  }

  type Callback = (flag?: boolean) => void;

  const enquireJs = enquire;

  export function enquireScreen(cb: Callback, query?: string): Options;
  export function unenquireScreen(handler: Options, query?: string): void;

  export default enquireJs;
}

@i-mighty
Copy link

i-mighty commented Jun 7, 2020

I have tried this declaration out and it works well. It would be awesome if it can be merged thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants