Browse Source

fix: typescript compile error

Signed-off-by: mertmit <mertmit99@gmail.com>
pull/4609/head
mertmit 2 years ago
parent
commit
297b58dcb9
  1. 4
      packages/nocodb/src/lib/meta/helpers/extractProps.ts

4
packages/nocodb/src/lib/meta/helpers/extractProps.ts

@ -1,6 +1,6 @@
import DOMPurify from 'isomorphic-dompurify'; import DOMPurify from 'isomorphic-dompurify';
export function extractProps<T>(body: T, props: string[]): Partial<T> { export function extractProps<T extends object>(body: T, props: string[]): Partial<T> {
// todo: throw error if no props found // todo: throw error if no props found
return props.reduce((o, key) => { return props.reduce((o, key) => {
if (key in body) o[key] = body[key]; if (key in body) o[key] = body[key];
@ -8,7 +8,7 @@ export function extractProps<T>(body: T, props: string[]): Partial<T> {
}, {}); }, {});
} }
export function extractPropsAndSanitize<T>( export function extractPropsAndSanitize<T extends object>(
body: T, body: T,
props: string[] props: string[]
): Partial<T> { ): Partial<T> {

Loading…
Cancel
Save