next.js
eb2a8512 - refactor: more precise typing for disjoint action metadata cases

Commit
201 days ago
refactor: more precise typing for disjoint action metadata cases `isFetchAction` and `!isFetchAction` are disjoint cases -- `isFetchAction` can only be true if `actionId` is present -- but `getServerActionMetadata`'s return type wasn't reflecting that. this PR splits it the type into two variants to more accurately model what's going on, and thus informs typescript that this is okay: ``` if (isFetchAction) { const x: string = actionId // always non-null here } ``` which lets us remove some `actionId!` casts and checks
Author
Committer
Parents
Loading