Effect CommunityEC
Effect Community3y ago
28 replies
Kristian Notari

Dealing with Optional Properties in TypeScript with "exactOptionalPropertyTypes": true

How do you normally deal with passing optional properties when you have "exactOptionalPropertyTypes": true in your tsconfig?
type Params = {
   a: string
   b?: number
}
const f = (params: Params) => { ... }
const g = (b?: number) => {
   f({ a: "hello", b: b }) // you can't do this so how you solve?
}
Was this page helpful?