Skip to content

Commit

Permalink
fix: don't consider out-of-file types to be a React component's props (
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaKGoldberg authored Mar 23, 2024
1 parent 0e84713 commit 3034910
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ const getFunctionComponentPropsNode = (
}

const [declaration] = symbol.declarations;
if (isReactComponentPropsNode(declaration)) {
// If the declaration is in another file... well, let's assume it's unrelated.
// TODO: We'll eventually need to handle shared props types.
if (isReactComponentPropsNode(declaration) && declaration.getSourceFile() === request.sourceFile) {
return declaration;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
(function () {
class Example {
method(): void {
document.body.querySelectorAll("*").forEach((child) => Array.from(child.classList));
}
}
})();
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
(function () {
class Example {
method(): void {
document.body.querySelectorAll("*").forEach((child) => Array.from(child.classList));
}
}
})();
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"jsx": "react"
},
"files": ["actual.tsx"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"fixes": {
"incompleteTypes": true
}
}

0 comments on commit 3034910

Please sign in to comment.