TypeScript
zx
TypeScript | zx | |
---|---|---|
1,353 | 118 | |
100,022 | 42,798 | |
0.6% | 0.8% | |
9.9 | 9.0 | |
4 days ago | 2 days ago | |
TypeScript | JavaScript | |
Apache License 2.0 | Apache License 2.0 |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
TypeScript
-
createStore in Zustand's source code explained.
const createStoreImpl: CreateStoreImpl = (createState) => { type TState = ReturnType type Listener = (state: TState, prevState: TState) => void let state: TState const listeners: Set = new Set() const setState: StoreApi['setState'] = (partial, replace) => { // TODO: Remove type assertion once https://github.com/microsoft/TypeScript/issues/37663 is resolved // https://github.com/microsoft/TypeScript/issues/37663#issuecomment-759728342 const nextState = typeof partial === 'function' ? (partial as (state: TState) => TState)(state) : partial if (!Object.is(nextState, state)) { const previousState = state state = (replace ?? (typeof nextState !== 'object' || nextState === null)) ? (nextState as TState) : Object.assign({}, state, nextState) listeners.forEach((listener) => listener(state, previousState)) } } const getState: StoreApi['getState'] = () => state const getInitialState: StoreApi['getInitialState'] = () => initialState const subscribe: StoreApi['subscribe'] = (listener) => { listeners.add(listener) // Unsubscribe return () => listeners.delete(listener) } const api = { setState, getState, getInitialState, subscribe } const initialState = (state = createState(setState, getState, api)) return api as any }
-
Building a Personal Finance App with Arcjet
Our application will be built using TypeScript and the technical stack will be:
-
What is your way declare types for objects in TypeScript?
TypeScript is a great "onbuild" for JavaScript that adds static types and helps us catch errors early during development, and even though, sometimes you need to break your brain to type some function it is still wonderful.
-
Object.is() usage in Zustand’s source code.
const setState: StoreApi['setState'] = (partial, replace) => { // TODO: Remove type assertion once https://github.com/microsoft/TypeScript/issues/37663 is resolved // https://github.com/microsoft/TypeScript/issues/37663#issuecomment-759728342 const nextState = typeof partial === 'function' ? (partial as (state: TState) => TState)(state) : partial if (!Object.is(nextState, state)) { const previousState = state state = (replace ?? (typeof nextState !== 'object' || nextState === null)) ? (nextState as TState) : Object.assign({}, state, nextState) listeners.forEach((listener) => listener(state, previousState)) } }
- 10 Reasons TypeScript is Transforming How We Build Web Apps
-
Casual Clothes App Using Next.js 14, TypeScript, Prisma & Next-Auth
TypeScript
-
Modern Web Development with Turborepo, Next.js, TailwindCSS, NestJS, and More…
Each package/app is 100% TypeScript.
-
Interesting TypeScript issue
As we can see, it has a typing issue as the comment. I quickly searched for solution, then I ended up following up this issue which was open long ago https://github.com/microsoft/TypeScript/issues/30581.
-
LogTape: Zero-Dependency Logging for JavaScript That Just Works
LogTape is a shiny new logging library for JavaScript and TypeScript that's designed with one goal in mind: to make logging simple, flexible, and hassle-free across all your JavaScript environments. Whether you're building applications for Deno, Node.js, Bun, edge functions, or browsers, LogTape has got you covered.
- Allow type annotations in .js files in preparation for Type Annotations proposal
zx
-
Effects of Gen AI on High Skilled Work: Experiments with Software Developers
You could try zx[1]! I prefer it to Bash scripting.
[1] https://github.com/google/zx
-
Free Introduction to Bash Scripting eBook
Tried https://github.com/google/zx and never looked back.
- Google/Zx v8.1
-
How and why do we bundle zx?
When zx first appeared, it was a tiny esm script that just proposed a new idea for how child_process.spawn API could be enhanced with string template literals.
- Zx 8.0
- Google ZX – A tool for writing better scripts
-
Dax – Cross-platform shell for Node.js
TIL about zx! https://github.com/google/zx
This suite of tools feels indispensable. Anything to keep me from having to write/maintain bash scripts that are more than a series of commands.
-
The Bun Shell
Great point! According to https://github.com/oven-sh/bun/blob/b433beb016470b87850f3c01..., Bun Shell took inspiration from zx[0], dax[1] and bnx[2]
[0]: https://github.com/google/zx
[1]: https://github.com/dsherret/dax
[2]: https://github.com/wobsoriano/bnx
- Zx: A tool for writing better scritps
-
My script to install husky, commitlint and lint-staged with zx
If you want test it, you can run this script withzx :
What are some alternatives?
zod - TypeScript-first schema validation with static type inference
shelljs - :shell: Portable Unix shell commands for Node.js
Flutter - Flutter makes it easy and fast to build beautiful apps for mobile and beyond
Commander.js - node.js command-line interfaces made easy
Tailwind CSS - A utility-first CSS framework for rapid UI development.
execa - Process execution for humans
esbuild - An extremely fast bundler for the web
oclif - CLI for generating, building, and releasing oclif CLIs. Built by Salesforce.
Yup - Dead simple Object schema validation
deno - A modern runtime for JavaScript and TypeScript.
gray-matter - Smarter YAML front matter parser, used by metalsmith, Gatsby, Netlify, Assemble, mapbox-gl, phenomic, vuejs vitepress, TinaCMS, Shopify Polaris, Ant Design, Astro, hashicorp, garden, slidev, saber, sourcegraph, and many others. Simple to use, and battle tested. Parses YAML by default but can also parse JSON Front Matter, Coffee Front Matter, TOML Front Matter, and has support for custom parsers. Please follow gray-matter's author: https://github.com/jonschlinkert
xonsh - :shell: Python-powered shell. Full-featured and cross-platform.