b56093f3ac
* 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.
15 lines
287 B
TypeScript
15 lines
287 B
TypeScript
// @allowJs: true
|
|
// @checkJs: true
|
|
// @noEmit: true
|
|
// @strict: true
|
|
// @noImplicitAny: true
|
|
// @Filename: a.js
|
|
|
|
/** @type {function(string): void} */
|
|
const f = (value) => {
|
|
value = 1 // should error
|
|
};
|
|
/** @type {(s: string) => void} */
|
|
function g(s) {
|
|
s = 1 // Should error
|
|
}
|