Skip to content

Commit

Permalink
Merge pull request #736 from mkszepp/fix-types
Browse files Browse the repository at this point in the history
Types: Separate Args and Signature
  • Loading branch information
mkszepp authored Jan 8, 2024
2 parents 189ec8f + 88507e6 commit 09108d3
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions ember-basic-dropdown/src/components/basic-dropdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,15 @@ export interface Dropdown {
const UNINITIALIZED = {};
const IGNORED_STYLES = ['top', 'left', 'right', 'width', 'height'];

interface Args {
interface BasicDropdownSignature {
Element: HTMLElement;
Args: BasicDropdownArgs;
Blocks: {
default: [api: Dropdown];
};
}

interface BasicDropdownArgs {
initiallyOpened?: boolean;
renderInPlace?: boolean;
verticalPosition?: string;
Expand All @@ -54,9 +61,6 @@ interface Args {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
contentComponent: string | ComponentLike<any>;
calculatePosition?: CalculatePosition;
Blocks: {
default: [api: Dropdown];
};
}

type RepositionChanges = {
Expand All @@ -70,7 +74,7 @@ type RepositionChanges = {
height?: string | undefined;
};

export default class BasicDropdown extends Component<Args> {
export default class BasicDropdown extends Component<BasicDropdownSignature> {
@tracked hPosition: string | null = null;
@tracked vPosition: string | null = null;
@tracked top: string | undefined;
Expand Down Expand Up @@ -138,7 +142,7 @@ export default class BasicDropdown extends Component<Args> {
}

// Lifecycle hooks
constructor(owner: Owner, args: Args) {
constructor(owner: Owner, args: BasicDropdownArgs) {
super(owner, args);
if (this.args.onInit) {
this.args.onInit(this.publicAPI);
Expand Down

0 comments on commit 09108d3

Please sign in to comment.