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
TTCTheo's Typesafe Cult
Created by AgainPsychoX on 8/8/2024 in #questions
dotfiles
A friend wrote this years ago (for setting up with symlinks): https://ryan.himmelwright.net/post/new-dotfiles/ I took the approach of just including a ./install.sh with mine to keep it simple and then I just run manually when I update things: https://github.com/tylerlaws0n/dotfiles This is the sort of thing where there are a million ways to do it, so it may be hard to find "best practices". I'd suggest just look around to see what you like and find what works for you 🙂
2 replies
TTCTheo's Typesafe Cult
Created by Leo Wang on 7/21/2024 in #questions
What's a good way to persist a single query for React Query
I might not understand the question, but the query client exists to persist query results. So if your query key is consistent, the query client dedupes the requests if they are called in more than one component, so you can feel free to call that same query in whatever component you'd like to call it without fear of over querying. This is a major reason you'd use react query to begin with.
5 replies
TTCTheo's Typesafe Cult
Created by juan on 7/13/2024 in #questions
How would you make a package that serves a web page across multiple frameworks AND nodejs?
Astro? https://astro.build/ It gives islands, so you can write in any framework and just import the appropriate plugin
8 replies
TTCTheo's Typesafe Cult
Created by Ttttmizer on 7/13/2024 in #questions
What is a tool that can help me update packages to latest?
4 replies
TTCTheo's Typesafe Cult
Created by pavels555 on 7/11/2024 in #questions
Types union and how to distinguish them?
I think your code is completely fine. If you’re interested in learning more for when/why to use enums… this is a fantastic post on optimizing JavaScript that includes a good section about string comparisons vs enums https://romgrk.com/posts/optimizing-javascript For your use case I can’t imaging it mattering without this event being checked tons of times, but still worth understanding the trade offs and when it matter I think.
3 replies
TTCTheo's Typesafe Cult
Created by Paulo Martins on 7/7/2024 in #questions
About Theo's take of not destructuring props
FWIW shadcn/ui uses this pattern repeatedly. Not saying that doesn’t mean that it still might not be optimal, but spreading props for components like ones you’d see in a UI library is super common. Would be interesting to hear a reason when/why not to do this though.
10 replies
TTCTheo's Typesafe Cult
Created by tylerlaws0n on 7/2/2024 in #questions
Has anyone had success running a Node server on Railway.app for cheap?
Dang. Nice then. That’s cheap considering it’s always on.
12 replies
TTCTheo's Typesafe Cult
Created by tylerlaws0n on 7/2/2024 in #questions
Has anyone had success running a Node server on Railway.app for cheap?
I think I might just turn this project into a CLI tool though for now and not host it 😅 It was a helpful exercise to set it up as a robust project to try out the tooling, but the cost to run it is massive overkill for what the tool does.
12 replies
TTCTheo's Typesafe Cult
Created by tylerlaws0n on 7/2/2024 in #questions
Has anyone had success running a Node server on Railway.app for cheap?
No description
12 replies
TTCTheo's Typesafe Cult
Created by tylerlaws0n on 7/2/2024 in #questions
Has anyone had success running a Node server on Railway.app for cheap?
Thanks! I'm just gonna read through 🙂 appreciate you sharing. The logic of what I need is very very simple and my goal is to cut the cost of my service, so this is really helpful to see as an example for running things cheaply. Do you use the railway setting to sleep when inactive?
12 replies
TTCTheo's Typesafe Cult
Created by tylerlaws0n on 7/2/2024 in #questions
Has anyone had success running a Node server on Railway.app for cheap?
That probably was a bit of it. I had high cpu usage without the flag as well though. Are your projects open source? I’d like to poke through the code to see if I can narrow anything else down if you’re ok with it.
12 replies
TTCTheo's Typesafe Cult
Created by Salumsu on 7/1/2024 in #questions
Extending react-query with typescript
Could you just export const usePaginatedQuery: typeof useQuery => (…?
14 replies