FIND YOUR NEXT FEW LINES

Results for “type guard”

Small, practical examples. Search by task or narrow things down below.

225 snippets foundClear filters
TypeScriptPromises & iteration protocols

Run dependent async steps in order

TypeScript: Await one result before using it as the input of the next calculation.

TypeScript✓ Tested
TypeScriptGetting Started

Run your first program

TypeScript: Start with a complete program that prints one line. Follow the run instructions below.

TypeScript✓ Tested
TypeScriptArray traversal & selection

Separate a first item from the remaining items

TypeScript: Array destructuring and a rest element produce named pieces of a sequence.

TypeScript✓ Tested
CSSType & reading flow

Separate an underline from the text

CSS: Text-underline-offset improves the gap between letters and a decorative underline.

CSS✓ Tested
CSSType & reading flow

Set an explicit font weight

CSS: Numeric font weights express typographic emphasis independently of a specific font family.

CSS✓ Tested
ReactEffects & lifecycle

Skip synchronization when a feature is disabled

Skip synchronization when a feature is disabled with a small React component and explicit browser behavior.

React✓ Tested
TypeScriptUTC date operations

Sort timestamp strings by their parsed instants

TypeScript: Compare epoch values explicitly when date strings may contain different offsets.

TypeScript✓ Tested
TypeScriptArray restructuring

Split an array into bounded batches

TypeScript: Advance by a positive batch size and allow a shorter final chunk.

TypeScript✓ Tested
TypeScriptRegular expressions & URL encoding

Split text on several separator characters

TypeScript: A regex character class can recognize alternative simple delimiters.

TypeScript✓ Tested
TypeScriptGetting Started

Store a value in a named variable

TypeScript: Give a value a descriptive name and print it.

TypeScript✓ Tested
RustFunctions & data types

Store data in an enum variant

Store data in an enum variant in a complete Rust program using the standard library.

Rust✓ Tested
CSSType & reading flow

Style supporting text in italics

CSS: Font-style changes presentation without adding semantic emphasis by itself.

CSS✓ Tested