TypeScript
- A Type-Safer Alternative to Type Guards in TypeScript8hob.io A Type-Safer Alternative to Type Guards in TypeScript
Type guards rely on the programmer to be correctly defined and are error-prone. We introduce the type extractor, which may be a safer alternative in many scenarios.
A trick that I'd like sharing :)
- Announcing TypeScript 5.6devblogs.microsoft.com Announcing TypeScript 5.6 - TypeScript
Today we’re excited to announce the release of TypeScript 5.6! If you’re not familiar with TypeScript, it’s a language that builds on top of JavaScript by adding syntax for types. Types describe the shapes we expect of our variables, parameters, and functions, and the TypeScript type-checker can hel...
- Announcing TypeScript 5.6 RCdevblogs.microsoft.com Announcing TypeScript 5.6 RC - TypeScript
Today we are excited to announce the availability of the release candidate of TypeScript 5.6. To get started using the RC, you can get it through npm with the following command: npm install -D typescript@rc Here’s a quick list of what’s new in TypeScript 5.6!
- [self post] Extensible TypeScript with Object Algebrasjnkr.tech Extensible TypeScript with Object Algebras · Programming should be enjoyable
A lightweight approach to maintainable systems
cross-posted from: https://programming.dev/post/18004176
> I think object algebras have huge potential to improve the way complex software is written but I've never seen them used in practice. I think one reason why is that the research paper which introduced them is pretty hard to read. This post is my attempt to change that. > > I've been working on this post off and on for like two years so I'm really excited to share it with people. It is very long. There's a lot of ground to cover.
- Looking for a guide to TypeScript for idiots
The issue? I'm the idiot. Any suggestions for a guide to JS/TS for someone trying to learn about front-end development.
- Announcing TypeScript 5.6 Betadevblogs.microsoft.com Announcing TypeScript 5.6 Beta - TypeScript
Today we are excited to announce the availability of TypeScript 5.6 Beta. To get started using the beta, you can get it through NuGet, or through npm with the following command: npm install -D typescript@beta Here’s a quick list of what’s new in TypeScript 5.6!
- Node.js adds experimental support for TypeScriptgithub.com module: add --experimental-strip-types by marco-ippolito · Pull Request #53725 · nodejs/node
It is possible to execute TypeScript files by setting the experimental flag --experimental-strip-types. Node.js will transpile TypeScript source code into JavaScript source code. During the transpi...
- Type-level Arithmetic in TypeScript: Part 1 - Type Safe Time Intervalsbrieuckaisin.hashnode.dev Type-level Arithmetic in TypeScript: Part 1 - Type Safe Time Intervals
Explore type-level arithmetic in TypeScript by creating type-safe time intervals. Learn to validate the chronology of times in a day at compile time
- Announcing TypeScript 5.5devblogs.microsoft.com Announcing TypeScript 5.5 - TypeScript
Today we’re excited to announce the release of TypeScript 5.5! If you’re not familiar with TypeScript, it’s a language that builds on top of JavaScript by making it possible to declare and describe types. Writing types in our code allows us to explain intent and have other tools check our code to ca...
- Writing exhaustive switch statements in TypeScriptarendjr.nl Writing exhaustive switch statements in TypeScript
A little trick that can help make switch statements more type-safe
Today I'm sharing a little trick that I like to use to make switch statements cleaner and more type-safe. Happy to hear other ideas!
- DBOS Cloud: A transactional serverless computing platform with first-class TypeScript environmentwww.dbos.dev Hello DBOS - Announcing DBOS Cloud
Introducing transactional serverless computing for TypeScript, enabled by a revolutionary new operating system that puts a distributed DBMS in the kernel of the OS.
> DBOS Cloud, a transactional serverless computing platform, made possible by a revolutionary new operating system, DBOS, that implements OS services on top of a distributed database. We’ve used this new architecture to build a novel TypeScript transactional programming environment that enhances applications with automatic statefulness, transactionality, observability, and cyber-resilience. This makes fault-tolerant cloud-native application development much simpler and faster.
- Announcing TypeScript 5.4devblogs.microsoft.com Announcing TypeScript 5.4 - TypeScript
Today we’re excited to announce the release of TypeScript 5.4! If you’re not familiar with TypeScript, it’s a language that builds on top of JavaScript by making it possible to declare and describe types. Writing types in our code allows us to explain intent and have other tools check our code to ca...
- Announcing TypeScript 5.4 RCdevblogs.microsoft.com Announcing TypeScript 5.4 RC - TypeScript
Today we’re excited to announce our Release Candidate of TypeScript 5.4! Between now and the stable release of TypeScript 5.4, we expect no further changes apart from critical bug fixes. To get started using the RC, you can get it through NuGet,
- Announcing TypeScript 5.4 Betadevblogs.microsoft.com Announcing TypeScript 5.4 Beta - TypeScript
Today we are excited to announce the availability of TypeScript 5.4 Beta. To get started using the beta, you can get it through NuGet, or through npm with the following command: npm install -D typescript@beta Here’s a quick list of what’s new in TypeScript 5.4!
- Remedagithub.com GitHub - remeda/remeda: A utility library for JavaScript and TypeScript.
A utility library for JavaScript and TypeScript. Contribute to remeda/remeda development by creating an account on GitHub.
Modern utility toolbelt - rapidly evolving, type safe and esm friendly out of the box. No mutations.
- typia
Typia is a transformer library supporting:
- Super-fast Runtime Validators
- Enhanced JSON functions
- Protocol Buffer encoder and decoder
- Random data generator
- GitHub - lorefnon/collection-joiner: Type-safe utilities to join multiple collections from different sources into a single hierarchygithub.com GitHub - lorefnon/collection-joiner: Type-safe utilities to join multiple collections from different sources into a single hierarchy
Type-safe utilities to join multiple collections from different sources into a single hierarchy - GitHub - lorefnon/collection-joiner: Type-safe utilities to join multiple collections from differen...
When developing APIs or writing integration solutions, we often fetch data from multiple sources and combine them together. This requires quite a bit of boilerplate even if you use utility libraries like lodash.
This library aims to be provide a simple type-safe utility that makes the task of combining multiple collections simpler using an intuitive association API.
You may find this API to be reminiscent of association APIs found in ORMs. However, collection-joiner is completely agnostic about how these collections are obtained - so you could for example, fetch a list of users from a database, a list of departments from another service, a list of roles from a key value store and merge them into a single hierarchy when constructing a response.
- OO awkward
addEventListener accept function references rather than objects with expected methods like handleEvent
setTimeout and setInterval array map, filter, reduce, forEach, etc. promise then, catch, finally
bind awkward
closures
what say v8? hidden classes
fully init objects give me more perf tips
- $20k Bounty was Claimed! · Prettierprettier.io $20k Bounty was Claimed! · Prettier
Prettier, a JavaScript code formatter, has seen an incredible adoption thanks to its careful handling of the very, very, long tail of ways people can write code. At this point, the formatting logic has been solid and after our work on [ternaries](https://prettier.io/blog/2023/11/13/curious-ternaries...
- Announcing TypeScript 5.3 - TypeScriptdevblogs.microsoft.com Announcing TypeScript 5.3 - TypeScript
Today we’re excited to announce the release of TypeScript 5.3! If you’re not familiar with TypeScript, it’s a language that adds type syntax to JavaScript to bring type-checking. Type-checking can catch all sorts of issues like typos and forgetting to check for null and undefined.
- How to Do a JS to TypeScript Conversionv5.chriskrycho.com How to Do a TypeScript Conversion — Sympolymathesy, by Chris Krycho
Addressing a very common question: do-it-as-you-go or follow the dependency graph?
- Announcing TypeScript 5.3 RCdevblogs.microsoft.com Announcing TypeScript 5.3 RC - TypeScript
Today we’re excited to announce our Release Candidate of TypeScript 5.3! Between now and the stable release of TypeScript 5.3, we expect no further changes apart from critical bug fixes. To get started using the RC, you can get it through NuGet,
- So, are enums ok or not?
I have googled this and even got to the second page, and there does not seem to be any kind of consensus.
As far as I can tell, it's a bad idea because it creates code you don't see and accepts inputs that you wouldn't want. And yet, many people seem to like them more than, say, const unions due to being easier to refactor in bulk.
So what gives? Is this a case of IT people having very strong opinions on stuff that doesn't matter? Or is there a technical reason for or against it?
- Feature rich type-safe database migration tool for posgressalsita.github.io node-pg-migrate - Postgresql database migration management tool for node.js
Postgresql database migration management tool for node.js
- Utility for type-safe functional pipeline composition with support for async steps/bailouts and moregithub.com GitHub - lorefnon/fluent-piper: Type-safe left-to-right functional pipeline composition
Type-safe left-to-right functional pipeline composition - GitHub - lorefnon/fluent-piper: Type-safe left-to-right functional pipeline composition
- Effective TypeScript › The Saga of the Closure Compiler, and Why TypeScript Woneffectivetypescript.com Effective TypeScript › The Saga of the Closure Compiler, and Why TypeScript Won
This post looks at the Closure Compiler, Google's tool from the mid-2000s for adding types to JavaScript. It looks at how its focus on minification led to very different design choices than TypeScript, and how this and a few other factors led to TypeScript becoming the ubiquitous solution for JavaSc...
- One Thing Nobody Explained To You About TypeScriptredd.one One Thing Nobody Explained To You About TypeScript
One of the most common mistakes in configuring TypeScript.
Click bait title, but this post goes into depth about using tsconfig.json correctly and across different layers of your project.
- TypeScript 5.3 First Lookwww.totaltypescript.com What's Coming In TypeScript 5.3?
TypeScript 5.3 is in the works, with potential features including Import Attributes, throw expressions, isolated declarations, and more.
- GitHub - dsherret/ts-morph: TypeScript Compiler API wrapper for static analysis and programmatic code changes.github.com GitHub - dsherret/ts-morph: TypeScript Compiler API wrapper for static analysis and programmatic code changes.
TypeScript Compiler API wrapper for static analysis and programmatic code changes. - GitHub - dsherret/ts-morph: TypeScript Compiler API wrapper for static analysis and programmatic code changes.
Working with the primary TS compiler API is pretty arduous. It is nice to see dedicated community effort towards making this more approachable.
- Big projects are ditching TypeScript… wtf? - The Code Report
YouTube Video
Click to view this content.
- Does anyone have recommendations on a raw postgres typing library? pgtyped vs zapatos vs slonik?
I've looked into these three and they all seem very similar and seem to cover the same use cases. Does anyone have experience with them? I'm having a hard time making a decision or even figuring out the pros and cons of each of them.
- type-safe GroupBy (key) function i wrote
i made a type-safe GroupBy function. ```typescript /**
- Groups array of objects by a given key
- @param arr array of objects to group
- @param key must be present on every object, and it's values must be string|number
- @author telepresence
- @license CC-BY-4.0
*/
function groupBy(arr: T[], key: keyof T, defaultAcc: Record = {}) {
return arr.reduce((acc, val, i) => {
const compValue = val[key];
if (typeof compValue !== 'string' && typeof compValue !== 'number') {
throw new Error(
key ${key.toString()} has values other than string/number. can only group by string/number values
); } if (!acc[compValue]) acc[compValue] = [] acc[compValue].push(val); return acc; }, defaultAcc); } ```
- like lodash's groupBy, but by key and not function
- group an array of objects which all have a key in common into an object with keys matching all the different possible values of your common key
- type-safe, no unknown's no any's
- does not copy arrays ([...array]), uses push
- supports selecting by keys, where the key values are string / number (although you can easily add symbol support)
- shared for free under the CC BY 4.0 license - only attribution is requred (link to this post is fine)
- custom default accumulator support, if you already know the groups beforehand and would rather have an empty array than undefined.
example: ```typescript const data = [{ "name": "jim", "color": "blue", "age": "22" }, { "name": "Sam", "color": "blue", "age": "33" }, { "name": "eddie", "color": "green", "age": "77" }];
groupBy(data, 'color')
would result into:
ts { "blue": [ { "name": "jim", "color": "blue", "age": "22" }, { "name": "Sam", "color": "blue", "age": "33" } ], "green": [ { "name": "eddie", "color": "green", "age": "77" } ] } ``` TL;DR i've sucessfully wrote something using generics in typescript for the first time, and i think it's pretty epic. - Typescript is implementing a using keywordwww.totaltypescript.com TypeScript 5.2's New Keyword: 'using'
TypeScript 5.2 introduces 'using', a keyword that disposes anything with a `Symbol.dispose` function upon leaving scope, making resource management easier.