Skip to content
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

Support for understanding some JSDoc annotations within JavaScript files. #2646

Closed
wants to merge 126 commits into from

Conversation

CyrusNajmabadi
Copy link
Contributor

These will be used in .js files to help inform the type system of the types of JS vars and functions.

CyrusNajmabadi and others added 5 commits June 29, 2015 19:37
Conflicts:
	src/compiler/binder.ts
	src/compiler/checker.ts
Conflicts:
	src/compiler/binder.ts
	src/compiler/checker.ts
	src/services/services.ts
Conflicts:
	src/compiler/checker.ts
Conflicts:
	src/compiler/checker.ts
@CyrusNajmabadi
Copy link
Contributor Author

// @type annotation might have been on the variable statement, try that instead.
let typeTag = getJSDocTypeTag(declaration.parent.parent);
if (typeTag) {
return typeTag.typeExpression.type;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will an invalid type tag, e.g. /** @type */ break the language service as the typeTag.typeExpression is undefined?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope. We'll return an missing node there which will result in the undefinedType being. If we see the undefined type, we'll fall back to normal TS inference.

@zhengbli zhengbli mentioned this pull request Aug 12, 2015
@@ -538,7 +556,7 @@ namespace ts {
}
}

function bindFunctionOrConstructorType(node: SignatureDeclaration) {
function bindFunctionOrConstructorTypeORJSDocFunctionType(node: SignatureDeclaration): void {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OR?

@mhegazy
Copy link
Contributor

mhegazy commented Sep 29, 2015

@mhegazy mhegazy closed this Sep 29, 2015
@mhegazy mhegazy deleted the jsDocSupport branch November 2, 2017 21:02
@microsoft microsoft locked and limited conversation to collaborators Jun 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants