Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix TypeScript errors #6061

Merged
merged 2 commits into from
Jul 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/chatty-bulldogs-dream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@keystone-ui/core': patch
'@keystone-next/types': patch
---

Fixed TypeScript errors in declarations
2 changes: 1 addition & 1 deletion design-system/packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"main": "dist/core.cjs.js",
"module": "dist/core.esm.js",
"devDependencies": {
"@types/facepaint": "^1.2.1",
"@types/react": "^17.0.11",
"react": "^17.0.2",
"react-dom": "^17.0.2"
Expand All @@ -17,6 +16,7 @@
"dependencies": {
"@babel/runtime": "^7.14.6",
"@emotion/react": "^11.4.0",
"@types/facepaint": "^1.2.1",
"facepaint": "^1.2.1"
},
"engines": {
Expand Down
14 changes: 7 additions & 7 deletions packages-next/types/src/legacy-filters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { schema } from '.';
const identity = (x: any) => x;

export const impls = {
equalityConditions<T>(fieldKey: string, f: (a: any) => any = identity) {
equalityConditions<T>(fieldKey: string, f: (a: any) => any = identity): any {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These things are because TypeScript generates declarations that are broken but having actual types for the returns types here doesn't matter.

return {
[fieldKey]: (value: T) => ({ [fieldKey]: { equals: f(value) } }),
[`${fieldKey}_not`]: (value: T | null) =>
Expand All @@ -14,7 +14,7 @@ export const impls = {
},
};
},
equalityConditionsInsensitive(fieldKey: string, f: (a: any) => any = identity) {
equalityConditionsInsensitive(fieldKey: string, f: (a: any) => any = identity): any {
return {
[`${fieldKey}_i`]: (value: string) => ({
[fieldKey]: { equals: f(value), mode: 'insensitive' },
Expand All @@ -31,7 +31,7 @@ export const impls = {
};
},

inConditions<T>(fieldKey: string, f: (a: any) => any = identity) {
inConditions<T>(fieldKey: string, f: (a: any) => any = identity): any {
return {
[`${fieldKey}_in`]: (value: (T | null)[]) =>
(value.includes(null)
Expand All @@ -56,7 +56,7 @@ export const impls = {
};
},

orderingConditions<T>(fieldKey: string, f: (a: any) => any = identity) {
orderingConditions<T>(fieldKey: string, f: (a: any) => any = identity): any {
return {
[`${fieldKey}_lt`]: (value: T) => ({ [fieldKey]: { lt: f(value) } }),
[`${fieldKey}_lte`]: (value: T) => ({ [fieldKey]: { lte: f(value) } }),
Expand All @@ -65,7 +65,7 @@ export const impls = {
};
},

containsConditions(fieldKey: string, f: (a: any) => any = identity) {
containsConditions(fieldKey: string, f: (a: any) => any = identity): any {
return {
[`${fieldKey}_contains`]: (value: string) => ({ [fieldKey]: { contains: f(value) } }),
[`${fieldKey}_not_contains`]: (value: string) => ({
Expand All @@ -74,7 +74,7 @@ export const impls = {
};
},

stringConditions(fieldKey: string, f: (a: any) => any = identity) {
stringConditions(fieldKey: string, f: (a: any) => any = identity): any {
return {
...impls.containsConditions(fieldKey, f),
[`${fieldKey}_starts_with`]: (value: string) => ({ [fieldKey]: { startsWith: f(value) } }),
Expand All @@ -88,7 +88,7 @@ export const impls = {
};
},

stringConditionsInsensitive(fieldKey: string, f: (a: any) => any = identity) {
stringConditionsInsensitive(fieldKey: string, f: (a: any) => any = identity): any {
return {
[`${fieldKey}_contains_i`]: (value: string) => ({
[fieldKey]: { contains: f(value), mode: 'insensitive' },
Expand Down