Results for “type checking”
Small, practical examples. Search by task or narrow things down below.
Respond while a user types
jQuery: Learn how to respond while a user types in a complete browser example.
jQuery✓ Tested
Return typed data from an async function
Await a Promise and handle failures explicitly.
async✓ Tested
Saturate arithmetic at the type boundary
Saturate arithmetic at the type boundary in a complete Rust program using the standard library.
Rust✓ Tested
Select fields with the Pick utility type
Expose a smaller view of a larger object type.
Pick✓ Tested
Sum typed values with reduce
Accumulate numeric array elements.
reduce✓ 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 an object update with Partial
Allow a caller to provide just the fields to change.
Partial✓ Tested
Use a fixed-size container with bounds checking
C++: std::array retains its element count and supports checked access through at.
C++✓ Tested
Use a wider type for a large count
Arduino / C: Use a wider type for a large count on an Uno with the Serial Monitor set to 9600 baud.
Arduino / C✓ Tested
Validate an unknown value with a type guard
Check a field before treating unknown data as a typed object.
unknown✓ Tested
Wrap a value in a distinct type
Wrap a value in a distinct type in a complete Rust program using the standard library.
Rust✓ Tested