ts-node
ts-node copied to clipboard
Can't have line breaks in object literals in REPL in some cases
In the REPL, I can't enter or paste an object literal across multiple lines if it has to conform to an interface/type: immediately after the opening { it throws errors.
Seems equivalent with #644, except with TS2741.
Steps to reproduce the problem
In the ts-node REPL, enter or paste this:
var o: { n: number } = {
n: 2
}
Well, it's enough to enter the first line to get errors, the rest just show how it could be completed.
Expected Behavior
Same as if it's all on one line:
undefined
Actual Behavior
After the first line:
<repl>.ts:4:5 - error TS2741: Property 'n' is missing in type '{}' but required in type '{ n: number; }'.
4 var o: { n: number } = {
~
<repl>.ts:4:10
4 var o: { n: number } = {
~
'n' is declared here.
<repl>.ts:5:1 - error TS1005: '}' expected.
5
<repl>.ts:4:24
4 var o: { n: number } = {
~
The parser expected to find a '}' to match the '{' token here.
Search Terms
object lines
Specifications
- ts-node version: v10.9.1
- node version: v20.3.1
- TypeScript version: v4.9.5
- Operating system and version: Linux, openSUSE Tumbleweed 20230731