{"library":"react-redux-typescript","title":"TypeScript Mapped Types & Utility Collection","description":"react-redux-typescript provides a robust collection of advanced TypeScript utility types, primarily focusing on 'Mapped Types' for complex object and key manipulation. As of version 3.11.0, it offers types like `DiffKeys`, `Omit`, `Assign`, `Overwrite`, `DeepReadonly`, `Optional`, `Required`, `Mutable`, and `UnionToIntersection`. It also includes a utility function `getReturnOfExpression` for inferring function return types. The library is actively maintained with frequent minor releases, though its name can be misleading as the React/Redux-specific parts (re-exports from `typesafe-actions`) are deprecated and slated for removal in future major versions. A key differentiator is its commitment to thorough type correctness testing, zero third-party runtime dependencies for its core utility types, and providing separate bundles for various module workflows (CommonJS, ES Module).","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install react-redux-typescript"],"cli":null},"imports":["import { Omit } from 'react-redux-typescript';","import { Assign } from 'react-redux-typescript';","import { getReturnOfExpression } from 'react-redux-typescript';","import { DeepReadonly } from 'react-redux-typescript';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import { Omit, Assign, DeepReadonly } from 'react-redux-typescript';\n\ninterface UserProfile {\n  id: string;\n  name: string;\n  email: string;\n  settings: {\n    theme: 'dark' | 'light';\n    notifications: boolean\n  };\n  createdAt: Date;\n}\n\ninterface PartialUpdate {\n  name?: string;\n  email?: string;\n  updatedAt: Date;\n}\n\n// Example 1: Omit properties from a type\ntype UserWithoutSensitiveInfo = Omit<UserProfile, 'email' | 'createdAt'>;\n// Expected: { id: string; name: string; settings: { theme: 'dark' | 'light'; notifications: boolean }; }\n\nconst user1: UserWithoutSensitiveInfo = {\n  id: '123',\n  name: 'Alice',\n  settings: { theme: 'dark', notifications: true }\n};\n\n// Example 2: Assign (merge) properties, overwriting if they exist\ntype MergedProfile = Assign<UserProfile, PartialUpdate>;\n// Expected: { id: string; name: string; email: string; settings: { theme: 'dark' | 'light'; notifications: boolean }; createdAt: Date; updatedAt: Date; }\n\nconst user2: MergedProfile = {\n  id: '456',\n  name: 'Bob',\n  email: 'bob@example.com',\n  settings: { theme: 'light', notifications: false },\n  createdAt: new Date(),\n  updatedAt: new Date()\n};\n\n// Example 3: Make all properties and nested properties readonly\ntype ReadonlyUserProfile = DeepReadonly<UserProfile>;\n\nconst readonlyUser: ReadonlyUserProfile = {\n  id: '789',\n  name: 'Charlie',\n  email: 'charlie@example.com',\n  settings: {\n    theme: 'light',\n    notifications: true\n  },\n  createdAt: new Date()\n};\n\n// readonlyUser.name = 'David'; // This line would cause a TypeScript error\n\nconsole.log('User without sensitive info:', user1);\nconsole.log('Merged profile:', user2);\nconsole.log('Readonly user (check types):', readonlyUser);\n","lang":"typescript","description":"Demonstrates `Omit`, `Assign`, and `DeepReadonly` utility types for manipulating object shapes and immutability.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}