camc314
d6b6705f8f
fix(parser): require arrow separator in TypeScript function types ( #26529 )
...
Require `=>` when parsing TypeScript function and constructor types, while retaining `:` for function, method, and arrow return annotations. Previously, any token could be consumed as the separator, accepting invalid types such as `type F = (): number` and `type F = new () + number`.
This also prevents a valid conditional expression from being silently grouped into the wrong arrows:
```ts
const a = true, b = 1, c = 2;
const f = a ? (b) : (): any => b ? c : (x = 1): any => x;
console.log(typeof f);
```
The transformed program now prints `number`; previously it printed `function`.
2026-09-10 13:05:18 +00:00
..
2026-07-21 12:43:21 +00:00
2026-07-21 12:43:21 +00:00
2026-09-07 15:07:31 +00:00
2026-09-07 15:07:31 +00:00
2026-09-06 07:44:47 +00:00
2026-09-09 13:04:01 +00:00
2026-09-09 13:04:01 +00:00
2026-08-07 23:03:24 +00:00
2026-08-07 23:03:24 +00:00
2026-03-26 14:17:31 +00:00
2026-09-09 15:21:18 +00:00
2026-08-08 10:59:23 +00:00
2026-09-07 14:34:52 +00:00
2026-09-07 14:34:52 +00:00
2026-09-07 14:34:52 +00:00
2026-09-07 14:34:52 +00:00
2026-09-07 14:34:52 +00:00
2026-09-07 14:34:52 +00:00
2026-09-07 14:34:52 +00:00
2026-09-07 14:34:52 +00:00
2026-01-16 16:08:27 +00:00
2026-01-16 16:08:27 +00:00
2026-01-16 16:08:27 +00:00
2026-01-16 16:08:27 +00:00
2026-09-10 10:10:39 +00:00
2026-08-28 18:45:13 +00:00
2025-11-08 06:53:50 +00:00
2026-09-06 21:17:34 +00:00
2025-11-16 09:25:13 +00:00
2026-09-07 16:03:31 +00:00
2026-09-09 13:22:34 +00:00
2026-07-15 18:38:30 +00:00
2025-12-06 08:30:06 +00:00
2026-09-07 12:41:32 +00:00
2026-09-07 12:41:32 +00:00
2026-09-07 12:41:32 +00:00
2026-09-07 12:41:32 +00:00
2026-09-07 12:41:32 +00:00
2026-09-07 12:41:32 +00:00
2026-09-09 14:03:17 +00:00
2026-09-09 14:03:17 +00:00
2026-09-07 15:34:10 +00:00
2026-01-23 11:35:33 +00:00
2026-01-23 11:35:33 +00:00
2025-11-04 13:13:00 +00:00
2025-11-04 13:13:00 +00:00
2025-11-04 13:13:00 +00:00
2025-11-04 13:13:00 +00:00
2025-11-04 13:13:00 +00:00
2025-11-04 13:13:00 +00:00
2025-11-04 13:13:00 +00:00
2025-11-04 13:13:00 +00:00
2025-11-04 13:13:00 +00:00
2025-11-04 13:13:00 +00:00
2025-11-04 13:13:00 +00:00
2025-11-17 02:58:51 +00:00
2026-01-24 15:25:10 +00:00
2025-11-17 02:58:51 +00:00
2025-11-16 02:57:35 +00:00
2025-11-17 02:58:51 +00:00
2026-05-25 09:58:50 +00:00
2026-01-06 14:45:14 +00:00
2026-01-06 14:45:14 +00:00
2025-11-25 18:51:16 +00:00
2025-11-17 02:58:51 +00:00
2025-11-17 02:58:51 +00:00
2026-06-07 02:05:14 +00:00
2026-06-16 14:50:53 +00:00
2026-06-16 14:50:53 +00:00
2025-11-16 02:57:34 +00:00
2025-11-16 02:57:34 +00:00
2026-09-10 10:30:38 +00:00
2025-12-14 21:30:55 +00:00
2025-12-16 11:30:44 +00:00
2025-11-04 13:12:59 +00:00
2025-11-04 13:12:59 +00:00
2025-03-04 10:42:54 +00:00
2025-03-04 10:42:54 +00:00
2025-03-04 10:42:54 +00:00
2025-04-01 13:05:30 +00:00
2025-04-27 15:42:11 +00:00
2025-05-01 15:04:48 +00:00
2025-05-14 05:37:08 +00:00
2025-06-04 09:00:02 +00:00
2025-06-04 14:09:25 +00:00
2025-06-05 05:37:27 +00:00
2025-06-12 03:58:17 +00:00
2025-06-11 17:15:56 +00:00
2025-11-02 12:08:56 +00:00
2025-06-05 05:01:20 +00:00
2025-12-21 08:14:16 +00:00
2025-06-08 11:46:56 +00:00
2025-06-11 12:28:00 +00:00
2025-06-11 12:28:00 +00:00
2025-06-11 12:28:00 +00:00
2025-08-29 11:33:21 +08:00
2025-08-29 11:33:21 +08:00
2025-08-29 11:33:21 +08:00
2025-08-29 11:33:21 +08:00
2025-08-29 11:33:21 +08:00
2025-08-29 11:33:21 +08:00
2025-08-29 11:33:21 +08:00
2025-08-29 11:33:21 +08:00
2025-08-29 11:33:21 +08:00
2025-08-29 11:33:21 +08:00
2025-08-29 11:33:21 +08:00
2025-08-29 11:33:21 +08:00
2025-09-09 09:28:39 +08:00
2025-08-29 11:33:21 +08:00
2025-08-29 11:33:21 +08:00
2025-08-29 11:33:21 +08:00
2025-08-29 11:33:21 +08:00
2025-08-29 11:33:21 +08:00
2025-08-29 11:33:21 +08:00
2025-08-29 11:33:21 +08:00
2025-08-29 11:33:21 +08:00
2025-08-29 11:33:21 +08:00
2025-09-09 09:28:39 +08:00
2025-09-09 09:28:39 +08:00
2025-09-09 09:28:39 +08:00
2025-09-09 09:28:39 +08:00
2025-09-09 09:28:39 +08:00
2025-06-25 12:42:32 +00:00
2025-06-25 12:42:32 +00:00
2025-08-01 16:19:30 +08:00
2025-08-01 16:19:30 +08:00
2025-08-01 04:42:56 +00:00
2025-08-01 04:42:56 +00:00
2025-08-01 04:42:56 +00:00
2025-08-01 04:42:56 +00:00
2025-09-01 22:54:27 +08:00
2025-09-10 03:23:41 +00:00
2025-09-10 03:23:41 +00:00
2025-09-10 03:23:41 +00:00
2025-08-29 13:10:08 +00:00
2025-09-13 21:27:09 +08:00
2025-09-13 21:27:09 +08:00
2025-09-13 21:27:09 +08:00
2025-09-13 21:27:09 +08:00
2025-10-05 09:11:58 +08:00
2025-09-23 12:56:23 +08:00
2025-10-27 11:04:22 +00:00
2025-11-25 09:43:09 +00:00
2026-01-20 14:09:09 +00:00
2026-05-18 05:50:19 +00:00
2026-06-04 04:05:46 +00:00
2026-06-10 07:46:45 +00:00
2026-07-15 10:38:34 +00:00
2026-07-15 10:38:34 +00:00
2026-08-12 13:58:51 +00:00
2026-08-12 11:25:27 +00:00
2026-07-14 10:16:51 +00:00
2026-08-15 06:58:08 +00:00
2026-08-15 06:58:08 +00:00
2026-08-15 06:58:08 +00:00
2026-08-15 06:58:08 +00:00
2026-08-15 06:58:08 +00:00
2026-08-15 05:02:23 +00:00
2026-06-11 08:39:25 +00:00
2026-05-25 12:47:34 +00:00
2026-05-25 12:47:34 +00:00
2026-09-06 08:36:56 +00:00
2026-01-17 12:18:26 +08:00
2026-03-26 14:00:25 +00:00
2025-11-16 02:57:35 +00:00
2026-09-09 12:26:51 +00:00
2026-09-09 12:26:51 +00:00
2026-09-09 12:26:51 +00:00
2026-09-09 12:26:51 +00:00
2026-09-09 12:26:51 +00:00
2026-09-10 13:05:18 +00:00
2026-09-10 13:05:18 +00:00
2026-09-10 13:05:18 +00:00
2026-09-10 13:05:18 +00:00
2026-09-10 13:05:18 +00:00
2026-09-10 13:05:18 +00:00
2026-09-10 13:05:18 +00:00
2026-09-10 13:05:18 +00:00
2026-08-07 06:00:42 +00:00
2026-06-05 13:10:42 +00:00
2026-06-05 13:10:42 +00:00
2026-06-05 13:10:42 +00:00
2026-09-07 17:43:20 +00:00
2026-07-24 09:46:34 +00:00