File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -411,6 +411,11 @@ export class FacadeConverter extends base.TranspilerBase {
411
411
// https://www.typescriptlang.org/docs/handbook/utility-types.html
412
412
const type = node . typeName . getText ( ) ;
413
413
switch ( type ) {
414
+ case 'Function' :
415
+ // We check this case to prevent generating JS$Function for the name; the keyword
416
+ // Function may be used as a type but not in other cases
417
+ name = 'Function' ;
418
+ break ;
414
419
case 'Partial' :
415
420
// Partial<X> is currently the same as X since all types are nullable in Dart
416
421
name = this . generateDartTypeName ( node . typeArguments [ 0 ] ) ;
Original file line number Diff line number Diff line change @@ -101,6 +101,11 @@ external set x(List<String> v);`);
101
101
external String Function(String) get x;
102
102
@JS()
103
103
external set x(String Function(String) v);` ) ;
104
+
105
+ expectTranslate ( 'declare var a: Function' ) . to . equal ( `@JS()
106
+ external Function get a;
107
+ @JS()
108
+ external set a(Function v);` ) ;
104
109
} ) ;
105
110
106
111
describe ( 'TypeScript utility types and other mapped types' , ( ) => {
You can’t perform that action at this time.
0 commit comments