Skip to content

Commit

Permalink
Format all files
Browse files Browse the repository at this point in the history
  • Loading branch information
aryaemami59 committed Feb 14, 2024
1 parent 0213df5 commit a181a5c
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 22 deletions.
10 changes: 6 additions & 4 deletions docs/api/createSelector.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ const draftSafeSelector = createWeakMapDraftSafeSelector(
As of RTK 2.1, you can define a "pre-typed" version of `createDraftSafeSelector` that can have the type for `state` built in. This lets you set up those types once, so you don't have to repeat them each time you call `createDraftSafeSelector`.

```ts no-transpile
const createTypedDraftSafeSelector = createDraftSafeSelector.withTypes<RootState>()
const createTypedDraftSafeSelector =
createDraftSafeSelector.withTypes<RootState>()
```

Import and use the pre-typed `createTypedDraftSafeSelector` function, and it will automatically know that the `state` argument is of type `RootState`.
Expand Down Expand Up @@ -125,13 +126,14 @@ export interface RootState {
alerts: Alert[]
}

export const createTypedDraftSafeSelector = createDraftSafeSelector.withTypes<RootState>()
export const createTypedDraftSafeSelector =
createDraftSafeSelector.withTypes<RootState>()

const selectTodoIds = createTypedDraftSafeSelector(
// Type of `state` is set to `RootState`, no need to manually set the type
state => state.todos,
(state) => state.todos,
// ❌ Known limitation: Parameter types are not inferred in this scenario
// so you will have to manually annotate them.
(todos: Todo[]) => todos.map(({ id }) => id)
(todos: Todo[]) => todos.map(({ id }) => id),
)
```
10 changes: 4 additions & 6 deletions docs/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,13 @@
"@reduxjs/toolkit": ["packages/toolkit/src/index.ts"],
"@reduxjs/toolkit/query": ["packages/toolkit/src/query/index.ts"],
"@reduxjs/toolkit/query/react": [
"packages/toolkit/src/query/react/index.ts",
"packages/toolkit/src/query/react/index.ts"
],
"@reduxjs/toolkit/dist/query/*": ["packages/toolkit/src/query/*"],
"@virtual/*": ["docs/virtual/*"],
"your-cool-library": ["docs/virtual/your-cool-library/index.ts"],
"redux-logger": ["docs/virtual/redux-logger/index.ts"],
"petstore-api.generated": [
"docs/virtual/petstore-api.generated/index.ts",
],
},
},
"petstore-api.generated": ["docs/virtual/petstore-api.generated/index.ts"]
}
}
}
4 changes: 2 additions & 2 deletions examples/publish-ci/expo/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extends": "expo/tsconfig.base",
"compilerOptions": {
"strict": true,
},
"strict": true
}
}
2 changes: 1 addition & 1 deletion examples/publish-ci/react-native/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"extends": "@react-native/typescript-config/tsconfig.json",
"extends": "@react-native/typescript-config/tsconfig.json"
}
6 changes: 3 additions & 3 deletions packages/rtk-query-codegen-openapi/test/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compilerOptions": {
"paths": {
"@/*": ["./test/fixtures/*"],
"@rtk-query/codegen-openapi": ["./src"],
"@rtk-query/codegen-openapi": ["./src"]
},
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
Expand All @@ -16,6 +16,6 @@
"resolveJsonModule": true,
"types": ["vitest/globals", "vitest/importMeta"],
"allowJs": true,
"checkJs": true,
},
"checkJs": true
}
}
4 changes: 2 additions & 2 deletions packages/rtk-query-codegen-openapi/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"types": ["vitest/globals", "vitest/importMeta"],
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"forceConsistentCasingInFileNames": true
},
"exclude": ["test", "lib", "vitest.config.mts"],
"exclude": ["test", "lib", "vitest.config.mts"]
}
4 changes: 2 additions & 2 deletions packages/rtk-query-graphql-request-base-query/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@

/* Advanced Options */
"skipLibCheck": true /* Skip type checking of declaration files. */,
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */,
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
},
"include": ["**/*.ts"],
"include": ["**/*.ts"]
}
4 changes: 2 additions & 2 deletions packages/toolkit/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"extends": "./tsconfig.test.json",
"compilerOptions": {
"skipLibCheck": true,
"rootDir": ".",
"rootDir": "."
},
"include": ["."],
"include": ["."]
}

0 comments on commit a181a5c

Please sign in to comment.