tylerlaws0n
tylerlaws0n
Explore posts from servers
Aarktype
Created by tylerlaws0n on 9/8/2024 in #questions
inferred type of '...' cannot be named without a reference to '...'
No description
20 replies
Aarktype
Created by tylerlaws0n on 9/8/2024 in #questions
inferred type of '...' cannot be named without a reference to '...'
This was the file where the error was occuring. It seems like this will be an internal issue only from what I can tell, so I just added the type annotation as was recommended by that github issue and the error message. It's neat to know that export * could also work, but it definitely does sound slower than I'd like.
diff --git a/e2e/fixtures/render-type/src/entries.tsx b/e2e/fixtures/render-type/src/entries.tsx
index 06a6bd1..cee13f2 100644
--- a/e2e/fixtures/render-type/src/entries.tsx
+++ b/e2e/fixtures/render-type/src/entries.tsx
@@ -3,27 +3,33 @@ import { createPages } from 'waku/router/server';
import { ServerEcho } from './ServerEcho.js';
import { ClientEcho } from './ClientEcho.js';

-export default createPages(async ({ createPage }) => [
- ...
-]);
+// This needs type annotations for the return type of createPages
+// @see https://github.com/microsoft/TypeScript/issues/42873#issuecomment-2065572017
+const router: ReturnType<typeof createPages> = createPages(
+ async ({ createPage }) => [
+ ...
+ ],
+);
+
+export default router;
diff --git a/e2e/fixtures/render-type/src/entries.tsx b/e2e/fixtures/render-type/src/entries.tsx
index 06a6bd1..cee13f2 100644
--- a/e2e/fixtures/render-type/src/entries.tsx
+++ b/e2e/fixtures/render-type/src/entries.tsx
@@ -3,27 +3,33 @@ import { createPages } from 'waku/router/server';
import { ServerEcho } from './ServerEcho.js';
import { ClientEcho } from './ClientEcho.js';

-export default createPages(async ({ createPage }) => [
- ...
-]);
+// This needs type annotations for the return type of createPages
+// @see https://github.com/microsoft/TypeScript/issues/42873#issuecomment-2065572017
+const router: ReturnType<typeof createPages> = createPages(
+ async ({ createPage }) => [
+ ...
+ ],
+);
+
+export default router;
20 replies
Aarktype
Created by tylerlaws0n on 9/8/2024 in #questions
inferred type of '...' cannot be named without a reference to '...'
yep! it was re-assuring to see that as validation that I wasn't mis-configuring something and seems to be a somewhat known issue.
20 replies
Aarktype
Created by tylerlaws0n on 9/8/2024 in #questions
inferred type of '...' cannot be named without a reference to '...'
Your old message did! haha I just didn't read it closely enough the first time
20 replies
Aarktype
Created by tylerlaws0n on 9/8/2024 in #questions
inferred type of '...' cannot be named without a reference to '...'
haha sorry for the scare! definitely good to know that for the future. I appreciate you taking a minute to respond here too 🙂
20 replies
Aarktype
Created by tylerlaws0n on 9/8/2024 in #questions
inferred type of '...' cannot be named without a reference to '...'
general ts question... sorry. I kinda just figured this would be a good place to check for an error as weird as this one 😅
20 replies
Aarktype
Created by tylerlaws0n on 9/8/2024 in #questions
inferred type of '...' cannot be named without a reference to '...'
It shows in this failed CI job here: https://github.com/dai-shi/waku/actions/runs/10761950734/job/29841704519?pr=854
Error: e2e/fixtures/render-type/src/entries.tsx(6,1): error TS2742: The inferred type of 'default' cannot be named without a reference to '../node_modules/waku/dist/router/common.js'. This is likely not portable. A type annotation is necessary.
Error: e2e/fixtures/render-type/src/entries.tsx(6,1): error TS2742: The inferred type of 'default' cannot be named without a reference to '../node_modules/waku/dist/router/common.js'. This is likely not portable. A type annotation is necessary.
20 replies
Aarktype
Created by tylerlaws0n on 9/8/2024 in #questions
inferred type of '...' cannot be named without a reference to '...'
Disregard this ^ I just read to the helpful comment in that ts thread 🤦‍♂️ https://github.com/microsoft/TypeScript/issues/42873#issuecomment-2065572017
20 replies