* Fix type when annotated with a JSDoc function type Previously, 1. A variable annotated with a JSDoc function type would not require all its parameters to be provided. This should only apply to functions without a type annotation. 2. A parameter in a function with a JSDoc function type annotation would still have the type 'any'. 3. Two `var` declarations in a Typescript and Javascript file, respectively, would error even when they had identical function types. * Update baselines and add constructor test * Handle ConstructorType too * Add test:method sig inside literal type * Contextually type parameters by parent sig's JSDoc Instead of a syntactic check in getJSDocTag * Remove redundant check:isUntypedSignatureInJSFile * Positive check for value signatures Instead of excluding type signatures piecemeal.
20 lines
329 B
TypeScript
20 lines
329 B
TypeScript
// @allowJs: true
|
|
// @checkJs: true
|
|
// @noEmit: true
|
|
// @strict: true
|
|
// @noImplicitAny: true
|
|
// @Filename: a.js
|
|
|
|
/** @type {function(string): void} */
|
|
const f = (value) => {
|
|
};
|
|
/** @type {(s: string) => void} */
|
|
function g(s) {
|
|
}
|
|
/** @type {{(s: string): void}} */
|
|
function h(s) {
|
|
}
|
|
|
|
f() // should error
|
|
g() // should error
|
|
h()
|