FIND YOUR NEXT FEW LINES
Results for “Types & reliable control flow”
Small, practical examples. Search by task or narrow things down below.
308 snippets foundClear filters
Transform each item in a collection
Build a result array with a foreach expression.
foreach✓ Tested
Truncate a single line
Combine CSS overflow and ellipsis for a constrained single line.
CSS✓ Tested
Turn JSON into typed rows
Project JSON array items into SQL columns.
OPENJSON✓ Tested
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 an object with a readonly input
Create a changed copy while retaining the original.
readonly✓ Tested
Validate an unknown value with a type guard
Check a field before treating unknown data as a typed object.
unknown✓ Tested