TypeScript

Creating a public view by stripping private keys in TypeScript

TypeScriptType ManipulationRemoving Keys via Mapped Typesadvanced

What this snippet does

Pattern matching in key remapping allows removing entire groups of keys, like internal properties prefixed with an underscore.

Expected output

{ name: 'Alice' }

Why practise typing this

Typing type manipulation code builds muscle memory for the symbols and indentation TypeScript uses most, which prose-based typing tests never cover. DevType measures your words per minute and accuracy on this snippet and tracks the individual characters you mistype, so later lessons can target them.

More TypeScript practice

Browse all TypeScript snippets →