Skip to content

Commit

Permalink
Merge pull request #1630 from johanrd/separate-args-and-signature
Browse files Browse the repository at this point in the history
types: Separate Args and Signature
  • Loading branch information
mkszepp committed Jan 7, 2024
2 parents eccfc2d + 074b993 commit 923863f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
6 changes: 3 additions & 3 deletions ember-power-select/src/components/power-select-multiple.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import Component from '@glimmer/component';
import { action } from '@ember/object';
import { isEqual } from '@ember/utils';
import type { PowerSelectArgs, Select } from './power-select';
import type { PowerSelectSignature, Select } from './power-select';

interface PowerSelectMultipleArgs extends PowerSelectArgs {
interface PowerSelectMultipleSignature extends PowerSelectSignature {
// any extra property for multiple selects?
}

export default class PowerSelectMultipleComponent extends Component<PowerSelectMultipleArgs> {
export default class PowerSelectMultipleComponent extends Component<PowerSelectMultipleSignature> {
get computedTabIndex() {
if (this.args.triggerComponent === undefined && this.args.searchEnabled) {
return '-1';
Expand Down
8 changes: 6 additions & 2 deletions ember-power-select/src/components/power-select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ interface Performable {
}
// Some args are not listed here because they are only accessed from the template. Should I list them?
export interface PowerSelectArgs {
Element: HTMLElement;
highlightOnHover?: boolean;
placeholderComponent?: string | ComponentLike<any>;
searchMessage?: string;
Expand Down Expand Up @@ -120,6 +119,11 @@ export interface PowerSelectArgs {
onBlur?: (select: Select, event: FocusEvent) => void;
scrollTo?: (option: any, select: Select) => void;
registerAPI?: (select: Select) => void;
}

export interface PowerSelectSignature {
Element: HTMLElement;
Args: PowerSelectArgs;
Blocks: {
default: [option: any, select: Select];
};
Expand All @@ -143,7 +147,7 @@ const isCancellablePromise = <T>(
return typeof thing.cancel === 'function';
};

export default class PowerSelectComponent extends Component<PowerSelectArgs> {
export default class PowerSelectComponent extends Component<PowerSelectSignature> {
// Untracked properties
_publicAPIActions = {
search: this._search,
Expand Down

0 comments on commit 923863f

Please sign in to comment.