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 f473cdf
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 25 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
8 changes: 2 additions & 6 deletions addon/utils/namespace.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import { OutgoingTriple } from '@lblod/ember-rdfa-editor/core/rdfa-processor';
import {
isRdfaAttrs,
RdfaAttrs,
RdfaResourceAttrs,
} from '@lblod/ember-rdfa-editor/core/schema';
import { isRdfaAttrs, RdfaAttrs } from '@lblod/ember-rdfa-editor/core/schema';
import {
sayDataFactory,
type SayNamedNode,
Expand Down Expand Up @@ -61,7 +57,7 @@ export function hasOutgoingNamedNodeTriple(
) {
return false;
}
return (rdfaAttrs as RdfaResourceAttrs).properties.some((prop) => {
return rdfaAttrs.properties.some((prop) => {
return (
prop.object.termType === 'NamedNode' &&
predicate.matches(prop.predicate) &&
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 f473cdf

Please sign in to comment.