Skip to content

Commit

Permalink
Merge pull request #13 from junyiacademy/fix/type-error
Browse files Browse the repository at this point in the history
Fix: type error of getPublicWidgets
  • Loading branch information
Kim716 authored Mar 25, 2024
2 parents e3124c9 + e59dc00 commit 155f131
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@junyiacademy/perseus-core",
"version": "1.0.28",
"version": "1.0.29",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"license": "MIT",
Expand Down
3 changes: 1 addition & 2 deletions packages/perseus/src/widgets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,8 @@ export const getVersionVector = (): {
return version;
};

export const getPublicWidgets = (): ReadonlyArray<WidgetExports> => {
export const getPublicWidgets = (): Record<string, WidgetExports> => {
// TODO(alex): Update underscore.js so that _.pick can take a function.
// @ts-expect-error - TS2740 - Type 'Pick<{ [key: string]: Readonly<{ name: string; displayName: string; getWidget?: (() => ComponentType<any>) | undefined; accessible?: boolean | ((props: any) => boolean) | undefined; hidden?: boolean | undefined; ... 10 more ...; widget: ComponentType<...>; }>; }, string>' is missing the following properties from type 'readonly Readonly<{ name: string; displayName: string; getWidget?: (() => ComponentType<any>) | undefined; accessible?: boolean | ((props: any) => boolean) | undefined; hidden?: boolean | undefined; ... 10 more ...; widget: ComponentType<...>; }>[]': length, concat, join, slice, and 18 more.
return _.pick(
widgets,
// @ts-expect-error - TS2345 - Argument of type '(name: string) => boolean | undefined' is not assignable to parameter of type 'Iteratee<string[], boolean, string>'.
Expand Down

0 comments on commit 155f131

Please sign in to comment.