Skip to content

Commit

Permalink
Improve types of variable plugin config
Browse files Browse the repository at this point in the history
  • Loading branch information
piemonkey committed Apr 17, 2024
1 parent 2b3babf commit 10a641c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 19 deletions.
9 changes: 8 additions & 1 deletion addon/components/variable-plugin/insert-variable-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,16 @@ import { hasGroups } from '@lblod/ember-rdfa-editor/utils/node-utils';
import { service } from '@ember/service';
import IntlService from 'ember-intl/services/intl';

type VariableComponentArgs = {
Args: {
Named: {
controller: SayController;
};
};
};
export type VariableConfig = {
label: string;
component: ComponentLike;
component: ComponentLike<VariableComponentArgs>;
options?: unknown;
};

Expand Down
6 changes: 0 additions & 6 deletions tests/dummy/app/controllers/editable-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,34 +204,28 @@ export default class EditableBlockController extends Controller {
return [
{
label: 'text',
// @ts-expect-error Unclear why these types don't agree
component: TextVariableInsertComponent,
},
{
label: 'number',
// @ts-expect-error Unclear why these types don't agree
component: NumberInsertComponent,
},
{
label: 'date',
// @ts-expect-error Unclear why these types don't agree
component: DateInsertVariableComponent,
},
{
label: 'location',
// @ts-expect-error Unclear why these types don't agree
component: LocationInsertComponent,
options: this.locationOptions,
},
{
label: 'codelist',
// @ts-expect-error Unclear why these types don't agree
component: CodelistInsertComponent,
options: this.codelistOptions,
},
{
label: 'address',
// @ts-expect-error Unclear why these types don't agree
component: VariablePluginAddressInsertVariableComponent,
},
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,34 +220,28 @@ export default class RegulatoryStatementSampleController extends Controller {
return [
{
label: 'text',
// @ts-expect-error Unclear why these types don't agree
component: TextVariableInsertComponent,
},
{
label: 'number',
// @ts-expect-error Unclear why these types don't agree
component: NumberInsertComponent,
},
{
label: 'date',
// @ts-expect-error Unclear why these types don't agree
component: DateInsertVariableComponent,
},
{
label: 'location',
// @ts-expect-error Unclear why these types don't agree
component: LocationInsertComponent,
options: this.locationOptions,
},
{
label: 'codelist',
// @ts-expect-error Unclear why these types don't agree
component: CodelistInsertComponent,
options: this.codelistOptions,
},
{
label: 'address',
// @ts-expect-error Unclear why these types don't agree
component: VariablePluginAddressInsertVariableComponent,
},
];
Expand Down
6 changes: 0 additions & 6 deletions tests/dummy/app/controllers/regulatory-statement-sample.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,34 +188,28 @@ export default class RegulatoryStatementSampleController extends Controller {
return [
{
label: 'text',
// @ts-expect-error Unclear why these types don't agree
component: TextVariableInsertComponent,
},
{
label: 'number',
// @ts-expect-error Unclear why these types don't agree
component: NumberInsertComponent,
},
{
label: 'date',
// @ts-expect-error Unclear why these types don't agree
component: DateInsertVariableComponent,
},
{
label: 'location',
// @ts-expect-error Unclear why these types don't agree
component: LocationInsertComponent,
options: this.locationOptions,
},
{
label: 'codelist',
// @ts-expect-error Unclear why these types don't agree
component: CodelistInsertComponent,
options: this.codelistOptions,
},
{
label: 'address',
// @ts-expect-error Unclear why these types don't agree
component: VariablePluginAddressInsertVariableComponent,
},
];
Expand Down

0 comments on commit 10a641c

Please sign in to comment.