Rendering

Runtime DTO projection

Application pattern: creates a new allowlisted object. A TypeScript annotation or assertion does not remove existing properties. Source: https://nextjs.org/docs/app/guides/data-security

Formal Syntax & Structure

nextjs syntaxnextjs
({ id: row.id, title: row.title })

Working Example

Example Snippetnextjs
type Article={id:string;title:string;owner:string;reviewNote:string};function toPublic(row:Article){return {id:row.id,title:row.title};}const row={id:'a1',title:'Reading trail',owner:'editor-a',reviewNote:'synthetic private note'};console.log(JSON.stringify(toPublic(row)));
Next.js Reference