Skip to content

No type-checking for @property with misspelled type across files #37040

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ghost opened this issue Feb 26, 2020 · 2 comments · Fixed by #37544
Closed

No type-checking for @property with misspelled type across files #37040

ghost opened this issue Feb 26, 2020 · 2 comments · Fixed by #37544
Assignees
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue

Comments

@ghost
Copy link

ghost commented Feb 26, 2020

TypeScript Version: 3.9.0-dev.20200225

Code

a.js

/**
 * @typedef MyType
 * @property {sting} [x]
 */

/** @param {MyType} p  */
export function f(p) {}

b.js

import {f} from "./a.js"
f({ x: 42 })

Expected behavior:

Error at sting.

Actual behavior:

No error.
There is an error if we call f({ x: 42 }) in a.js.

@DanielRosenwasser
Copy link
Member

I'm not seeing this locally - do you have a repro? Is a.js actually being type-checked?

@ghost
Copy link
Author

ghost commented Feb 27, 2020

I'm testing this in a directory with only 3 files -- a.js and b.js as above and this tsconfig.json:

{
	"compilerOptions": {
		"allowJs": true,
		"checkJs": true,
		"noEmit": true,
	}
}

I can verify that a.js is being type-checked by adding this at the bottom:

/** @type {numbr} */
const x = 3

which correctly produces an error.

I'm also seeing an interesting effect in the editor -- when I make a whitespace change to b.js and go back to a.js the error appears, but when I make another (whitespace) change to a.js the error disappears. But running tsc at the command line I never see an error.

@RyanCavanaugh RyanCavanaugh added the Needs Investigation This issue needs a team member to investigate its status. label Feb 27, 2020
@RyanCavanaugh RyanCavanaugh added this to the TypeScript 3.9.0 milestone Feb 27, 2020
@sheetalkamat sheetalkamat added Bug A bug in TypeScript Fixed A PR has been merged for this issue and removed Needs Investigation This issue needs a team member to investigate its status. labels Mar 17, 2020
sheetalkamat added a commit that referenced this issue Mar 23, 2020
@sheetalkamat sheetalkamat added Fix Available A PR has been opened for this issue and removed Fixed A PR has been merged for this issue labels Mar 23, 2020
sheetalkamat added a commit that referenced this issue Mar 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants