Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/parser/reparser.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func (p *Parser) reparseJSDocSignature(jsSignature *ast.Node, fun *ast.Node, jsD
case ast.KindConstructor:
signature = p.factory.NewConstructorDeclaration(clonedModifiers, nil, nil, nil, nil, nil)
case ast.KindJSDocCallbackTag:
signature = p.factory.NewFunctionTypeNode(nil, nil, nil)
signature = p.factory.NewFunctionTypeNode(nil, nil, p.factory.NewKeywordTypeNode(ast.KindAnyKeyword))
default:
panic("Unexpected kind " + fun.Kind.String())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ declare const example2: {
constructor: () => void;
};
declare function evaluate(): any;
type callback = (error: any, result: any) ;
type callback = (error: any, result: any) => any;
declare const example3: {
/**
* @overload evaluate(options = {}, [callback])
Expand All @@ -156,65 +156,3 @@ declare const example3: {
*/
evaluate: (options: any, callback: any) => void;
};


//// [DtsFileErrors]


dist/jsFileAlternativeUseOfOverloadTag.d.ts(34,43): error TS1005: '=>' expected.


==== dist/jsFileAlternativeUseOfOverloadTag.d.ts (1 errors) ====
declare function Example1(value: any): any;
declare const example1: {
/**
* @overload Example1(value)
* Creates Example1
* @param value [String]
*/
constructor: (value: any, options: any) => void;
};
declare function Example2(value: any, secretAccessKey: any, sessionToken: any): any;
declare function Example2(): any;
declare const example2: {
/**
* Example 2
*
* @overload Example2(value)
* Creates Example2
* @param value [String]
* @param secretAccessKey [String]
* @param sessionToken [String]
* @example Creates with string value
* const example = new Example('');
* @overload Example2(options)
* Creates Example2
* @option options value [String]
* @example Creates with options object
* const example = new Example2({
* value: '',
* });
*/
constructor: () => void;
};
declare function evaluate(): any;
type callback = (error: any, result: any) ;
~
!!! error TS1005: '=>' expected.
declare const example3: {
/**
* @overload evaluate(options = {}, [callback])
* Evaluate something
* @note Something interesting
* @param options [map]
* @return [string] returns evaluation result
* @return [null] returns nothing if callback provided
* @callback callback function (error, result)
* If callback is provided it will be called with evaluation result
* @param error [Error]
* @param result [String]
* @see callback
*/
evaluate: (options: any, callback: any) => void;
};

Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
+ constructor: () => void;
+};
+declare function evaluate(): any;
+type callback = (error: any, result: any) ;
+type callback = (error: any, result: any) => any;
+declare const example3: {
/**
* @overload evaluate(options = {}, [callback])
Expand All @@ -99,66 +99,4 @@
- */
-type callback = (error: any, result: any) => any;
+ evaluate: (options: any, callback: any) => void;
+};
+
+
+//// [DtsFileErrors]
+
+
+dist/jsFileAlternativeUseOfOverloadTag.d.ts(34,43): error TS1005: '=>' expected.
+
+
+==== dist/jsFileAlternativeUseOfOverloadTag.d.ts (1 errors) ====
+ declare function Example1(value: any): any;
+ declare const example1: {
+ /**
+ * @overload Example1(value)
+ * Creates Example1
+ * @param value [String]
+ */
+ constructor: (value: any, options: any) => void;
+ };
+ declare function Example2(value: any, secretAccessKey: any, sessionToken: any): any;
+ declare function Example2(): any;
+ declare const example2: {
+ /**
+ * Example 2
+ *
+ * @overload Example2(value)
+ * Creates Example2
+ * @param value [String]
+ * @param secretAccessKey [String]
+ * @param sessionToken [String]
+ * @example Creates with string value
+ * const example = new Example('');
+ * @overload Example2(options)
+ * Creates Example2
+ * @option options value [String]
+ * @example Creates with options object
+ * const example = new Example2({
+ * value: '',
+ * });
+ */
+ constructor: () => void;
+ };
+ declare function evaluate(): any;
+ type callback = (error: any, result: any) ;
+ ~
+!!! error TS1005: '=>' expected.
+ declare const example3: {
+ /**
+ * @overload evaluate(options = {}, [callback])
+ * Evaluate something
+ * @note Something interesting
+ * @param options [map]
+ * @return [string] returns evaluation result
+ * @return [null] returns nothing if callback provided
+ * @callback callback function (error, result)
+ * If callback is provided it will be called with evaluation result
+ * @param error [Error]
+ * @param result [String]
+ * @see callback
+ */
+ evaluate: (options: any, callback: any) => void;
+ };
+
+};
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ declare namespace MyClass {
declare namespace MyClass {
var staticProperty: number;
}
export type DoneCB = (failures: number) ;
export type DoneCB = (failures: number) => any;
/**
* Callback to be invoked when test execution is complete.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
+declare namespace MyClass {
+ var staticProperty: number;
+}
+export type DoneCB = (failures: number) ;
+export type DoneCB = (failures: number) => any;
/**
* Callback to be invoked when test execution is complete.
- */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ declare namespace BaseFactory {
export = BaseFactory;
//// [file.d.ts]
type BaseFactory = import('./base');
type BaseFactoryFactory = (factory: import('./base')) ;
type BaseFactoryFactory = (factory: import('./base')) => any;
/** @typedef {import('./base')} BaseFactory */
/**
* @callback BaseFactoryFactory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
- };
-};
+type BaseFactory = import('./base');
+type BaseFactoryFactory = (factory: import('./base')) ;
+type BaseFactoryFactory = (factory: import('./base')) => any;
/** @typedef {import('./base')} BaseFactory */
/**
* @callback BaseFactoryFactory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ function flatMap(array, iterable = identity) {


//// [templateInsideCallback.d.ts]
type Call = () ;
type Call = () => any;
/**
* @typedef Oops
* @template T
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
- * @returns {T[]}
- */
-declare function flatMap(): any;
+type Call = () ;
+type Call = () => any;
/**
* @typedef Oops
* @template T
Expand Down