Skip to content

Commit

Permalink
refactor: change to Signature type parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
guidojw committed Oct 15, 2023
1 parent 5c0cca7 commit d03cbe4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
16 changes: 9 additions & 7 deletions app/components/model-form/file-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ import type { UploadFile } from 'ember-file-upload';
import { action } from '@ember/object';
import { tracked } from '@glimmer/tracking';

export interface FileInputSignature extends TextInputSignature {
validMimeTypes?: string[];
validExtensions?: string[];
loadedCallback: (
file: UploadFile,
data: Awaited<ReturnType<UploadFile['readAsDataURL']>>
) => void;
export interface FileInputSignature {
Args: TextInputSignature['Args'] & {
validMimeTypes?: string[];
validExtensions?: string[];
loadedCallback: (
file: UploadFile,
data: Awaited<ReturnType<UploadFile['readAsDataURL']>>
) => void;
};
}

export default class FileInput extends TextInput<FileInputSignature> {
Expand Down
14 changes: 8 additions & 6 deletions app/components/model-form/text-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ import Component from '@glimmer/component';
import type Model from '@ember-data/model';

export interface TextInputSignature<T extends Model = Model> {
inputLayout?: string;
labelClass?: string;
inputWrapperClass?: string;
model: T;
property: keyof T;
label: string;
Args: {
inputLayout?: string;
labelClass?: string;
inputWrapperClass?: string;
model: T;
property: keyof T;
label: string;
};
}

export default class TextInput<
Expand Down

0 comments on commit d03cbe4

Please sign in to comment.