File tree 4 files changed +59
-19
lines changed
4 files changed +59
-19
lines changed Original file line number Diff line number Diff line change 73
73
},
74
74
"name": "typeName",
75
75
"returns": {
76
- "optional": true,
77
76
"primitive": "any"
78
77
}
79
78
}
103
102
}
104
103
},
105
104
"version": "0.7.8",
106
- "fingerprint": "K1rAUs6WiQ5lF08T46B8v/5UL8T8Ot59e0Nc8rh2jiQ ="
105
+ "fingerprint": "FbKHAP60R40tOOnvhCeDrZDrNlgzIypOfAdWPed+Jog ="
107
106
}
Original file line number Diff line number Diff line change @@ -939,3 +939,12 @@ export interface IInterfaceWithMethods {
939
939
export interface IInterfaceThatShouldNotBeADataType extends IInterfaceWithMethods {
940
940
readonly otherValue : string ;
941
941
}
942
+
943
+ /**
944
+ * jsii#284: do not recognize "any" as an optional argument
945
+ */
946
+ export class DoNotRecognizeAnyAsOptional {
947
+ public method ( _requiredAny : any , _optionalAny ?: any , _optionalString ?: string ) {
948
+
949
+ }
950
+ }
Original file line number Diff line number Diff line change 382
382
"type": {
383
383
"collection": {
384
384
"elementtype": {
385
- "optional": true,
386
385
"primitive": "any"
387
386
},
388
387
"kind": "array"
394
393
"type": {
395
394
"collection": {
396
395
"elementtype": {
397
- "optional": true,
398
396
"primitive": "any"
399
397
},
400
398
"kind": "map"
401
399
}
402
400
}
403
401
},
402
+ {
403
+ "name": "anyProperty",
404
+ "type": {
405
+ "primitive": "any"
406
+ }
407
+ },
404
408
{
405
409
"name": "arrayProperty",
406
410
"type": {
528
532
"type": {
529
533
"collection": {
530
534
"elementtype": {
531
- "optional": true,
532
535
"primitive": "any"
533
536
},
534
537
"kind": "array"
540
543
"type": {
541
544
"collection": {
542
545
"elementtype": {
543
- "optional": true,
544
546
"primitive": "any"
545
547
},
546
548
"kind": "map"
547
549
}
548
550
}
549
551
},
550
552
{
551
- "name": "anyProperty ",
553
+ "name": "unknownProperty ",
552
554
"type": {
553
- "optional": true,
554
555
"primitive": "any"
555
556
}
556
557
},
560
561
"fqn": "jsii-calc.StringEnum",
561
562
"optional": true
562
563
}
563
- },
564
- {
565
- "name": "unknownProperty",
566
- "type": {
567
- "optional": true,
568
- "primitive": "any"
569
- }
570
564
}
571
565
]
572
566
},
1301
1295
],
1302
1296
"name": "DoNotOverridePrivates"
1303
1297
},
1298
+ "jsii-calc.DoNotRecognizeAnyAsOptional": {
1299
+ "assembly": "jsii-calc",
1300
+ "docs": {
1301
+ "comment": "jsii#284: do not recognize \"any\" as an optional argument"
1302
+ },
1303
+ "fqn": "jsii-calc.DoNotRecognizeAnyAsOptional",
1304
+ "initializer": {
1305
+ "initializer": true
1306
+ },
1307
+ "kind": "class",
1308
+ "methods": [
1309
+ {
1310
+ "name": "method",
1311
+ "parameters": [
1312
+ {
1313
+ "name": "_requiredAny",
1314
+ "type": {
1315
+ "primitive": "any"
1316
+ }
1317
+ },
1318
+ {
1319
+ "name": "_optionalAny",
1320
+ "type": {
1321
+ "optional": true,
1322
+ "primitive": "any"
1323
+ }
1324
+ },
1325
+ {
1326
+ "name": "_optionalString",
1327
+ "type": {
1328
+ "optional": true,
1329
+ "primitive": "string"
1330
+ }
1331
+ }
1332
+ ]
1333
+ }
1334
+ ],
1335
+ "name": "DoNotRecognizeAnyAsOptional"
1336
+ },
1304
1337
"jsii-calc.DoubleTrouble": {
1305
1338
"assembly": "jsii-calc",
1306
1339
"fqn": "jsii-calc.DoubleTrouble",
3062
3095
{
3063
3096
"name": "value",
3064
3097
"returns": {
3065
- "optional": true,
3066
3098
"primitive": "any"
3067
3099
}
3068
3100
}
3412
3444
}
3413
3445
},
3414
3446
"version": "0.7.8",
3415
- "fingerprint": "Xn7Rk17rqR3AaMx3+ssxT0GR1sCWwz0OGC+C8QuLI3A ="
3447
+ "fingerprint": "2BaszImarh4WChl9DFUcygfTpEfXU17fHQT2wgEptfM ="
3416
3448
}
Original file line number Diff line number Diff line change @@ -812,7 +812,7 @@ export class Assembler implements Emitter {
812
812
this . _diagnostic ( declaration ,
813
813
ts . DiagnosticCategory . Error ,
814
814
`Only string index maps are supported` ) ;
815
- elementtype = { primitive : spec . PrimitiveType . Any , optional : true } ;
815
+ elementtype = { primitive : spec . PrimitiveType . Any } ;
816
816
}
817
817
return {
818
818
collection : {
@@ -830,7 +830,7 @@ export class Assembler implements Emitter {
830
830
}
831
831
// tslint:disable-next-line:no-bitwise
832
832
if ( type . flags & ( ts . TypeFlags . Any | ts . TypeFlags . Unknown ) ) {
833
- return { primitive : spec . PrimitiveType . Any , optional : true } ;
833
+ return { primitive : spec . PrimitiveType . Any } ;
834
834
}
835
835
} else if ( type . symbol . valueDeclaration && isUnder ( type . symbol . valueDeclaration . getSourceFile ( ) . fileName , this . stdlib ) ) {
836
836
switch ( type . symbol . name ) {
You can’t perform that action at this time.
0 commit comments