Skip to content

Commit

Permalink
Create types
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Carver <mark.carver@me.com>
  • Loading branch information
markhalliwell committed Dec 16, 2019
1 parent 20bd751 commit 9af07d3
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"main": "dist/vue-media-queries.js",
"module": "dist/vue-media-queries.mjs",
"jsnext:main": "dist/vue-media-queries.mjs",
"types" : "src/index.d.ts",
"keywords": [
"vue",
"mediaqueries",
Expand Down
27 changes: 27 additions & 0 deletions src/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import Vue, { VueConstructor, ComponentOptions, PluginFunction } from 'vue'
import { default as bands } from '../src/bands'

export declare interface MediaQueryBands {
mixin: ComponentOptions<Vue>
[key: string]: any
}

export declare class MediaQueries {
constructor(options?: { bands: MediaQueryBands })
expr(expressionString): boolean
below(...args): boolean
above(...args): boolean
between(...args): boolean
beyond(...args): boolean
install(Vue): PluginFunction<VueConstructor>
}

export declare type CommonBands<T, K extends keyof bands> = {
[K in keyof T]: MediaQueryBands
}

declare module 'vue/types/vue' {
interface Vue {
readonly $mq: MediaQueries
}
}

0 comments on commit 9af07d3

Please sign in to comment.