Practicing Typescript: Generalized Algebraic Data Types
Reddit » TypeScript
by /u/arabello5
8h ago
submitted by /u/arabello5 [visit reddit] [comments ..read more
Visit website
Return generic anaonymous functions from a IIFE
Reddit » TypeScript
by /u/Cp995
20h ago
Hi Reddit, Suppose we have type GenFunc = <A = void, B = void>({ a?: A, b?: B }) => Promise<void> I have written a IIFE to return a function that does something depending on an external variable const num = 1 // substitue for an external variable const genFunc: GenFunc = (() => { switch (num) { case 1: return async ({ a, b }) => { console.log(a) console.log(b) await fetch("http://example.com") // just an awaited function, nothing to do with the code } case 2: ... ... ... default: return async({ body, params }) => {} } } })() I'm not able to access the a and b de ..read more
Visit website
CodePilot for VS Code
Reddit » TypeScript
by /u/ayushmaansingh304
1d ago
I made this VS Code extension, which allows you to access documentation, frameworks, and libraries right within VS Code. If you find it useful, you can get it from here: Code Pilot - VS Code Extension. If you have any suggestions for websites to be added, please feel free to mention them in the comments. Alternatively, you are welcome to contribute to the extension yourself. submitted by /u/ayushmaansingh304 [visit reddit] [comments ..read more
Visit website
Who's hiring Typescript developers May
Reddit » TypeScript
by /u/PUSH_AX
3d ago
The monthly thread for people to post openings at their companies. ​ * Please state the job location and include the keywords REMOTE, INTERNS and/or VISA when the corresponding sort of candidate is welcome. When remote work is not an option, include ONSITE. ​ * Please only post if you personally are part of the hiring company—no recruiting firms or job boards **Please report recruiters or job boards**. ​ * Only one post per company. ​ * If it isn't a household name, explain what your company does. Sell it. ​ * Please add the company email that applications should be sent to, or the companies ..read more
Visit website
React 19 Beta: Major Updates to Async Transactions are Here
Reddit » TypeScript
by /u/Puzzleheaded_Ad4030
3d ago
submitted by /u/Puzzleheaded_Ad4030 [visit reddit] [comments ..read more
Visit website
Can Typescript for React props be terser?
Reddit » TypeScript
by /u/parsim
3d ago
Thanks in advance for any replies. I'm new to Typescript and looking at migrating a JS app, and before I get too deep I want to make sure I really am supposed to write out every prop parameter twice. E.g. in JS: function GameList({ userId, sessionId, opt, mode }) { ... } In TS: type GameListProps = { userId: number, sessionId: number, opt?: any, mode?: string, }; function GameList({ userId, sessionId, opt, mode }: GameListProps) { ... } Now when I modify this in the future, I have to update two places and keep them in sync. I assume there's a good reason I'm currently missing? Like why ..read more
Visit website
Generate types from imported third party object
Reddit » TypeScript
by /u/Devastion
4d ago
Hi, devs! I've been trying to achieve the following goal, but without success. I want to import object from a third party package, then use the keys as type and export the type. I want to build/compile (it is types only package in monorepo) and then use in other packages. Some of the imports are promises. Is there any good approach to do it? Here is quick pseudo code: import { someObject } from "awesome-package" type someType = { [P in keyof typeof someObject\]: boolean; } export { someType } submitted by /u/Devastion [visit reddit] [comments ..read more
Visit website
What's the difference between Readonly utility type vs readonly modifier?
Reddit » TypeScript
by /u/agent007bond
4d ago
It seems the documentation suggests they are practically the same, and it's a matter of developer preference. Is that really so, or are there some rare cases where there's an actual difference? Readonly<Type> example: interface Todo { title: string; } const todo: Readonly<Todo> = { title: "Delete inactive users", }; todo.title = "Hello"; // Cannot assign to 'title' because it is a read-only property. readonly Properties example: interface SomeType { readonly prop: string; } function doSomething(obj: SomeType) { // We can read from 'obj.prop'. console.log(`prop has the value ..read more
Visit website
Type definitions extracting
Reddit » TypeScript
by /u/lorens_osman
4d ago
i know its a dumb question but i will ask anyway, imagine you can write code like this : //math.ts function add(x: number, y: number): number { return x + y; } //another.ts import type {add} from './math.ts' const foo : add and ts will extract the type definition from add function to foo const , and whenever i made change in add function thats will reflect with errors or warnings in 'another.ts' file ? submitted by /u/lorens_osman [visit reddit] [comments ..read more
Visit website
Is there an alternative to Nest?
Reddit » TypeScript
by /u/alexandreqo
4d ago
I am searching for an alternative to Nest.js, but I haven't been able to find any framework that is as comprehensive as Nest. I'm looking for a solution that includes features such as Dependency Injection, ORM, Authentication, and Authorization. Are there any good alternatives to Nest or a suitable stack that meets these requirements that you would recommend? submitted by /u/alexandreqo [visit reddit] [comments ..read more
Visit website

Follow Reddit » TypeScript on FeedSpot

Continue with Google
Continue with Apple
OR