Skip to content

Commit

Permalink
add typescript declarations (for Glint)
Browse files Browse the repository at this point in the history
  • Loading branch information
BoussonKarel committed Oct 5, 2023
1 parent fd1958b commit 9f982d2
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
15 changes: 13 additions & 2 deletions ember-click-outside/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"author": "Gabor Babicz <[email protected]>",
"files": [
"addon-main.js",
"dist"
"dist",
"types"
],
"scripts": {
"build": "rollup --config",
Expand Down Expand Up @@ -63,7 +64,17 @@
},
"exports": {
".": "./dist/index.js",
"./*": "./dist/*.js",
"./*": {
"types": "./types/*.d.ts",
"default": "./dist/*.js"
},
"./addon-main.js": "./addon-main.js"
},
"typesVersions": {
"*": {
"*": [
"types/*"
]
}
}
}
17 changes: 17 additions & 0 deletions ember-click-outside/types/modifiers/on-click-outside.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import type Modifier from 'ember-modifier';

export interface ClickOutsideSignature {
Element?: HTMLElement;
Args: {
Positional: [action: (event: Event) => unknown];
Named:
| never
| {
capture?: boolean;
eventType?: keyof DocumentEventMap;
exceptSelector?: string;
};
};
}

export default class ClickOutsideModifier extends Modifier<ClickOutsideSignature> {}
5 changes: 5 additions & 0 deletions ember-click-outside/types/template-registry.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import OnClickOutside from './modifiers/on-click-outside';

export default class EmberClickOutsideRegistry {
'on-click-outside': typeof OnClickOutside;
}

0 comments on commit 9f982d2

Please sign in to comment.