TS: add test case with nested literals

This commit is contained in:
Asger F
2019-04-05 15:21:31 +01:00
parent cb22192378
commit d7bfeeefd0
4 changed files with 54 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
| tst.ts:2:3:2:6 | name | string |
| tst.ts:3:3:3:10 | children | T[] |
| tst.ts:6:5:6:5 | x | T |
| tst.ts:6:12:17:1 | {\\n nam ... }\\n ]\\n} | { name: string; children: ({ name: string; } \| ... |
| tst.ts:7:3:7:6 | name | string |
| tst.ts:7:9:7:11 | 'x' | "x" |
| tst.ts:8:3:8:10 | children | ({ name: string; } \| { name: string; children: ... |
| tst.ts:8:13:16:3 | [\\n { ... }\\n ] | ({ name: string; } \| { name: string; children: ... |
| tst.ts:9:5:9:18 | { name: 'x1' } | { name: string; } |
| tst.ts:9:7:9:10 | name | string |
| tst.ts:9:13:9:16 | 'x1' | "x1" |
| tst.ts:10:5:15:5 | {\\n ... ]\\n } | { name: string; children: { name: string; }[]; } |
| tst.ts:11:7:11:10 | name | string |
| tst.ts:11:13:11:16 | 'x2' | "x2" |
| tst.ts:12:7:12:14 | children | { name: string; }[] |
| tst.ts:12:17:14:7 | [\\n ... ] | { name: string; }[] |
| tst.ts:13:9:13:22 | { name: 'x3' } | { name: string; } |
| tst.ts:13:11:13:14 | name | string |
| tst.ts:13:17:13:20 | 'x3' | "x3" |

View File

@@ -0,0 +1,4 @@
import javascript
from Expr e
select e, e.getType()

View File

@@ -0,0 +1 @@
{ "include": ["."] }

View File

@@ -0,0 +1,30 @@
interface T {
name: string;
children?: T[];
}
let context: T = {
name: 'x',
children: [
{ name: 'x1' },
{
name: 'x2',
children: [
{ name: 'x3' }
]
}
]
}
let nocontext = {
name: 'x',
children: [
{ name: 'x1' },
{
name: 'x2',
children: [
{ name: 'x3' }
]
}
]
}