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

[labs/analyzer] Don't extract JSDoc types in TS. Port type tests to JS. #3658

Merged
merged 5 commits into from
Feb 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/dry-ravens-drop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@lit-labs/analyzer': minor
---

JSDoc types in TS files now have no effect on the analyzer's output, matching TS itself.
7 changes: 1 addition & 6 deletions packages/labs/analyzer/src/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,8 @@ export const getTypeForNode = (
node: ts.Node,
analyzer: AnalyzerInterface
): Type => {
// Since getTypeAtLocation will return `any` for an untyped node, to support
// jsdoc @type for JS (TBD), we look at the jsdoc type first.
const jsdocType = ts.getJSDocType(node);
return getTypeForType(
jsdocType
? analyzer.program.getTypeChecker().getTypeFromTypeNode(jsdocType)
: analyzer.program.getTypeChecker().getTypeAtLocation(node),
analyzer.program.getTypeChecker().getTypeAtLocation(node),
node,
analyzer
);
Expand Down