mirror of
https://github.com/github/codeql.git
synced 2026-05-05 05:35:13 +02:00
TS: Expose optional parameters at syntax level
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
| tst.ts:1:23:1:23 | y |
|
||||
| tst.ts:2:16:2:16 | y |
|
||||
| tst.ts:6:28:6:28 | y |
|
||||
| tst.ts:8:12:8:12 | x |
|
||||
| tst.ts:8:24:8:24 | y |
|
||||
| tst.ts:9:13:9:13 | x |
|
||||
| tst.ts:13:7:13:7 | x |
|
||||
| tst.ts:14:13:14:13 | x |
|
||||
| tst.ts:15:17:15:17 | y |
|
||||
| tst.ts:18:26:18:26 | y |
|
||||
| tst.ts:18:30:18:30 | z |
|
||||
| tst.ts:18:34:18:34 | w |
|
||||
| tst.ts:20:40:20:45 | {x, y} |
|
||||
| tst.ts:20:49:20:51 | [w] |
|
||||
| withDefault.ts:1:22:1:22 | x |
|
||||
@@ -0,0 +1,3 @@
|
||||
import javascript
|
||||
|
||||
query Parameter optionalParams() { result.isDeclaredOptional() }
|
||||
@@ -0,0 +1,20 @@
|
||||
function f(x: number, y?: string) {
|
||||
return (x, y?) => {};
|
||||
}
|
||||
|
||||
class C {
|
||||
constructor(x: number, y?: string) {}
|
||||
|
||||
method(x?: number, y?: string) {}
|
||||
noTypes(x?) {}
|
||||
}
|
||||
|
||||
interface I {
|
||||
m(x?: number);
|
||||
field: (x?: number) => void;
|
||||
(x: number, y?: string): void;
|
||||
}
|
||||
|
||||
function manyDefaults(x, y?, z?, w?) {}
|
||||
|
||||
declare function optionalDestructuring({x, y}?, [w]?);
|
||||
@@ -0,0 +1 @@
|
||||
function withDefault(x? = 5) {} // not valid syntax
|
||||
Reference in New Issue
Block a user