#functiontypesintypescript 검색 결과

"#functiontypesintypescript"에 대한 결과가 없습니다

One of the most useful and annoying TypeScript features.

leNicDev's tweet image. One of the most useful and annoying TypeScript features.

New --inline-types flag (-I) Generate TypeScript types directly in your schema file: export const userSchema = z.object({ ... }); export type User = z.infer<typeof userSchema>; One file. No separate .d.ts needed.


Great indeed. But you lost the direct destructuring. I like to use also: `type Result<T> = [status: 'success', data: T, error: null] | [status: 'error', data: null, error: Error]; const [status, data, error] = fn();` But you have some extra fields.


People are talking crap in comments which is funny because generating reflection data from typescript types is exactly what I did in my project, "call" type_of and get type data at runtime.

DoctorGester's tweet image. People are talking crap in comments which is funny because generating reflection data from typescript types is exactly what I did in my project, &quot;call&quot; type_of and get type data at runtime.
DoctorGester's tweet image. People are talking crap in comments which is funny because generating reflection data from typescript types is exactly what I did in my project, &quot;call&quot; type_of and get type data at runtime.
DoctorGester's tweet image. People are talking crap in comments which is funny because generating reflection data from typescript types is exactly what I did in my project, &quot;call&quot; type_of and get type data at runtime.

You wrap the function in a wrapper that checks types when it is called.


What if there was a decorator to enforce function types at runtime, which just adds guard clauses at the top of the scope and before each return (if there’s a return type) @validate function (input: InputType) {

No offense to the Zod devs but I don't understand why Zod has to exist. Why can't we just use the schema format we already have, that is, TypeScript? Why is there no way to construct a schema validator from a TypeScript type? This seems like such an obvious thing.



You should be able to use a TypeScript type for that! Descriptions can come from doc comments!


I feel like one of my PRs with the biggest impact on TypeScript has just been merged. If you’ve ever noticed `prop: function() {}` causing TS to behave differently than `prop: () => {}`, you’re in for a treat: github.com/microsoft/Type…


typescript utility types are your friend ☺️ typescriptlang.org/docs/handbook/…


Type Assertion: let numericLength = (response as string).length - Force-tells TypeScript what the type should be. #ChaiAurTypescript

mayurbadgujar36's tweet image. Type Assertion:
let numericLength = (response as string).length

- Force-tells TypeScript what the type should be.

#ChaiAurTypescript

Using types, we can narrow the number for tips using something like type-fest which has a GreaterThan<A, B> type to ensure that a LowTip is actually lower than Medium and High. TypeScript doesn't have true Higher Kinded types, so you'll run into challenges using number constants.


This is actually valid TypeScript but it doesn't do what you would expect Would be cool if it did tho

ipla03's tweet image. This is actually valid TypeScript but it doesn&apos;t do what you would expect

Would be cool if it did tho

Enforce exhaustive checking at compile time with TypeScript's Record utility type 👇 #TypeScript

KaraBharat's tweet image. Enforce exhaustive checking at compile time with TypeScript&apos;s Record utility type 👇

#TypeScript

Elysia/TypeBox for example use the Function constructor, which I believe isn't required but would still be a breaking change on our side


"#functiontypesintypescript"에 대한 결과가 없습니다
"#functiontypesintypescript"에 대한 결과가 없습니다
Loading...

Something went wrong.


Something went wrong.


United States Trends