Results for “du”
Small, practical examples. Search by task or narrow things down below.
Type a dictionary with Record
Limit a lookup table to a known set of keys.
Record✓ Tested
Type a function’s inputs and output
Catch mismatched arguments during compilation.
function✓ Tested
Type an object update with Partial
Allow a caller to provide just the fields to change.
Partial✓ Tested
Update a running count
TypeScript: Change a variable after its initial value has been assigned.
TypeScript✓ Tested
Update an object with a readonly input
Create a changed copy while retaining the original.
readonly✓ Tested
Use the first fulfilled promise result
JavaScript: Promise.any ignores individual rejections until one input fulfills.
JavaScript✓ Tested
Use the first fulfilled promise result
TypeScript: Promise.any ignores individual rejections until one input fulfills.
TypeScript✓ Tested
Validate a finite numeric value without coercion
TypeScript: Number.isFinite rejects numeric strings as well as NaN and infinity.
TypeScript✓ Tested
Validate a whole ASCII identifier
TypeScript: Use an anchored expression without the multiline flag and reject a trailing line break explicitly.
TypeScript✓ Tested
Validate an unknown value with a type guard
Check a field before treating unknown data as a typed object.
unknown✓ Tested
Visit every item in a collection
TypeScript: Print each element in the collection’s original order.
TypeScript✓ Tested
Wait for a background job before reading its output
Bash Scripts: Save the job PID and wait explicitly before consuming files it produces.
Bash Scripts✓ Tested