Results for “Type & reading flow”
Small, practical examples. Search by task or narrow things down below.
Read a property with keyof
Keep the key and returned value tied to an object type.
keyof✓ Tested
Read a small INI configuration
Python: Use ConfigParser typed accessors for configuration values stored as text.
Python✓ Tested
Safely read a caught error
Check the error type before accessing its message.
unknown✓ 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
Accept different types with a generic function
Accept different types with a generic function in a complete Rust program using the standard library.
Rust✓ Tested
Accept one typed value at a time from a pipeline
PowerShell: An advanced function uses process to handle each pipeline item.
PowerShell✓ Tested
Add a button with an explicit type
HTML: Learn how to add a button with an explicit type in a complete browser example.
HTML✓ Tested
Allocate and free a typed array
C: Use sizeof on the pointed-to type and check allocation success before writing.
C✓ Tested
Bind a typed nonnullable FormControl
Bind a typed nonnullable FormControl with a standalone Angular component and explicit browser behavior.
Angular✓ Tested
Borrow local data in a scoped thread
Borrow local data in a scoped thread in a complete Rust program using the standard library.
Rust✓ Tested
Calculate a page count without an overflowing addition
C: Divide first and add one only when a nonzero remainder remains.
C✓ Tested