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 fetchData(callback: (data: string) => void): void {
2 setTimeout(() => {
3 callback("Hello, World!");
4 }, 1000);
5}
6
7fetchData((data) => {
8 console.log(data);
9});
10

After

1async function fetchData(): Promise<string> {
2 return new Promise((resolve) => {
3 setTimeout(() => {
4 resolve("Hello, World!");
5 }, 1000);
6 });
7}
8
9(async () => {
10 const data = await fetchData();
11 console.log(data);
12})();
13

Before

program
function_declaration
function "function"
identifier "fetchData"
formal_parameters
( "("
required_parameter
identifier "callback"
type_annotation
: ":"
function_type
formal_parameters
( "("
required_parameter
identifier "data"
type_annotation
: ":"
predefined_type
string "string"
) ")"
=> "=>"
predefined_type
void "void"
) ")"
type_annotation
: ":"
predefined_type
void "void"
statement_block
{ "{"
expression_statement
call_expression
identifier "setTimeout"
arguments
( "("
arrow_function
formal_parameters
( "("
) ")"
=> "=>"
statement_block
{ "{"
expression_statement
call_expression
identifier "callback"
arguments
( "("
string
" "\""
string_fragment "Hello, World!"
" "\""
) ")"
; ";"
} "}"
, ","
number "1000"
) ")"
; ";"
} "}"
expression_statement
call_expression
identifier "fetchData"
arguments
( "("
arrow_function
formal_parameters
( "("
required_parameter
identifier "data"
) ")"
=> "=>"
statement_block
{ "{"
expression_statement
call_expression
member_expression
identifier "console"
. "."
property_identifier "log"
arguments
( "("
identifier "data"
) ")"
; ";"
} "}"
) ")"
; ";"

After

program
function_declaration
async "async"
function "function"
identifier "fetchData"
formal_parameters
( "("
) ")"
type_annotation
: ":"
generic_type
type_identifier "Promise"
type_arguments
< "<"
predefined_type
string "string"
> ">"
statement_block
{ "{"
return_statement
return "return"
new_expression
new "new"
identifier "Promise"
arguments
( "("
arrow_function
formal_parameters
( "("
required_parameter
identifier "resolve"
) ")"
=> "=>"
statement_block
{ "{"
expression_statement
call_expression
identifier "setTimeout"
arguments
( "("
arrow_function
formal_parameters
( "("
) ")"
=> "=>"
statement_block
{ "{"
expression_statement
call_expression
identifier "resolve"
arguments
( "("
string
" "\""
string_fragment "Hello, World!"
" "\""
) ")"
; ";"
} "}"
, ","
number "1000"
) ")"
; ";"
} "}"
) ")"
; ";"
} "}"
expression_statement
call_expression
parenthesized_expression
( "("
arrow_function
async "async"
formal_parameters
( "("
) ")"
=> "=>"
statement_block
{ "{"
lexical_declaration
const "const"
variable_declarator
identifier "data"
= "="
await_expression
await "await"
call_expression
identifier "fetchData"
arguments
( "("
) ")"
; ";"
expression_statement
call_expression
member_expression
identifier "console"
. "."
property_identifier "log"
arguments
( "("
identifier "data"
) ")"
; ";"
} "}"
) ")"
arguments
( "("
) ")"
; ";"