Code view:

A painting is a person's account of this edit as text, recorded independently of the node mapping - a rendering often has several equally defensible answers where the mapping has one. Deletions and insertions carry no position on the opposite side in a painting, so that panel draws no caret for them.

Before

1function addUser(name, age) {
2 return {
3 name: name,
4 age: age,
5 createdAt: new Date()
6 };
7}
8
9const user = addUser("Alice", 30);
10console.log(user);
11

After

1interface User {
2 name: string;
3 age: number;
4 createdAt: Date;
5}
6
7function addUser(name: string, age: number): User {
8 return {
9 name: name,
10 age: age,
11 createdAt: new Date()
12 };
13}
14
15const user: User = addUser("Alice", 30);
16console.log(user);
17

Before

program
function_declaration
function "function"
identifier "addUser"
formal_parameters
( "("
required_parameter
identifier "name"
, ","
required_parameter
identifier "age"
) ")"
statement_block (+28 nodes collapsed)
lexical_declaration
const "const"
variable_declarator
identifier "user"
= "="
call_expression
identifier "addUser"
arguments
( "("
string
" "\""
string_fragment "Alice"
" "\""
, ","
number "30"
) ")"
; ";"
expression_statement
call_expression
member_expression
identifier "console"
. "."
property_identifier "log"
arguments
( "("
identifier "user"
) ")"
; ";"

After

program
interface_declaration
interface "interface"
type_identifier "User"
interface_body
{ "{"
property_signature
property_identifier "name"
type_annotation
: ":"
predefined_type
string "string"
; ";"
property_signature
property_identifier "age"
type_annotation
: ":"
predefined_type
number "number"
; ";"
property_signature
property_identifier "createdAt"
type_annotation
: ":"
type_identifier "Date"
; ";"
} "}"
function_declaration
function "function"
identifier "addUser"
formal_parameters
( "("
required_parameter
identifier "name"
type_annotation
: ":"
predefined_type
string "string"
, ","
required_parameter
identifier "age"
type_annotation
: ":"
predefined_type
number "number"
) ")"
type_annotation
: ":"
type_identifier "User"
statement_block (+28 nodes collapsed)
lexical_declaration
const "const"
variable_declarator
identifier "user"
type_annotation
: ":"
type_identifier "User"
= "="
call_expression
identifier "addUser"
arguments
( "("
string
" "\""
string_fragment "Alice"
" "\""
, ","
number "30"
) ")"
; ";"
expression_statement
call_expression
member_expression
identifier "console"
. "."
property_identifier "log"
arguments
( "("
identifier "user"
) ")"
; ";"