Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

types: Separate Args and Signature #1630

Merged
merged 1 commit into from
Jan 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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