Skip to content

Instantly share code, notes, and snippets.

Avatar
🚓
DEFUND THE POLICE

Orta Therox orta

🚓
DEFUND THE POLICE
View GitHub Profile
@orta
orta / rfc.md
Last active Sep 8, 2021
A proposal for improving TS2322 error messages
View rfc.md

This is a work in progress. Please don't take this as something that will definitely happen, we all know what happens to well laid plans and I need to present it to the rest of the TypeScript team in order to figure out a lot of feasibility questions.

Intro

The examples in this PR assumes [CLI DX] Improve positioning of compiler error messaging info #45717 is merged

In 4.4, all diagnostic messages from TypeScript are treated the same, we have a massive .JSON file of ±2000 diagnostic messages which are used everywhere from compiler messages to CLI help. Aside from some simple string manipulation, these are effectively what we output for all error messages. I'd like to propose that we break this pattern, just for error TS2322.

TS2322 is our 'type x is not assignable to y' error, you'd see it for const str: string = 123 and I expect it is the most seen

@orta
orta / tsc-compiler-errors-3.svg
Last active Sep 6, 2021
Ideas for TSC with prettier pretty settings - click raw on this svg below
View tsc-compiler-errors-3.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View gist:dd0868bc8cd780f4ac81aaf30e7f8d34
[229,"collections"
[237,"json3"
[240,"intl"
[242,"ofe"
[245,"rickshaw"
[246,"webcrypto"
[249,"tsc-watch"
[253,"slackdown"
[256,"node-os-utils"
[256,"touch-events"
@orta
orta / upload.yml
Created Feb 5, 2021
Upload GitHub Action
View upload.yml
name: Upload infra
on:
push:
branches:
- main
- prod
jobs:
build-and-deploy:
@orta
orta / files.sh
Created Jan 26, 2021
Number of html files in the TypeScript website
View files.sh
❯ tree packages/typescriptlang-org/public -P "*.html"
packages/typescriptlang-org/public
├── Handbook
│   └── index.html
├── License.html
├── Playground
│   └── index.html
├── Tutorial
│   └── index.html
@orta
orta / snowpack-plugin-assets.js
Last active Dec 6, 2020
A simple snowpack plugin for generating a .d.ts file for paths inside an asset folder
View snowpack-plugin-assets.js
// @ts-check
const fs = require("fs")
const { join, basename } = require("path")
const { format } = require("prettier")
let log = undefined
/** @type {import("snowpack").SnowpackPluginFactory} */
function plugin(_snowpackConfig, _pluginOptions) {
@orta
orta / review.md
Created Nov 5, 2020
Orta's self review - late 2020
View review.md

Core Priorities

  1. Lower the barrier of entry to adopting and understanding TypeScript. North star.

  2. Understand the TypeScript Codebase enough to provide useful API documentation and fix bugs. Validated by having a more comprehensive set of tools for people to understand how the language and tooling works.

  3. Make contributing to TypeScript easier, and reduce the amount of work maintainers need to do. Validated probably by the number of open PRs, and the number of external contributors per release.

  4. Make it easier to people wanting to build tooling around TypeScript. Validated by seeing more usage of tools like the community discord, people shipping tools with TypeScript support by default etc.

@orta
orta / prs.csv
Created Oct 13, 2020
Pull Requests per day to DefinitelyTyped
View prs.csv
2012-10-11 1
2012-10-18 3
2012-10-24 1
2012-10-25 3
2012-10-26 2
2012-10-29 3
2012-10-30 4
2012-10-31 1
2012-11-01 1
2012-11-02 3
@orta
orta / _npm-vs-yarn.md
Last active Nov 1, 2020
Yarn vs npm CLI
View _npm-vs-yarn.md

These are the common everyday commands used in most projects:

Installing a package deps

npm install

yarn install
@orta
orta / tsconfig-oneliners.csv
Last active Aug 24, 2020
TSConfig one-liners
View tsconfig-oneliners.csv
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 9.
Name,Site,Schema
compilerOptions,"The set of compiler options for your project","Instructs the TypeScript compiler how to compile .ts files"
allowJs,"Let TS include .JS files in imports","Allow javascript files to be compiled."
allowSyntheticDefaultImports,"Allow 'import x from y' when a module doesn't have a default export","Allow default imports from modules with no default export. This does not affect code emit, just typechecking."
allowUmdGlobalAccess,"Assume UMD imports are all globally available","Allow accessing UMD globals from modules."
allowUnreachableCode,"Error when code will never be called","Do not report errors on unreachable code."
allowUnusedLabels,"Error when accidentally creating a label","Do not report errors on unused labels."
alwaysStrict,"Ensure 'use strict' is always emitted","Parse in strict mode and emit 'use strict' for each source file. Requires TypeScript version 2.1 or later."
assumeChangesOnlyAffectDirectDependencies,"A drastically faster, but occasionally inaccurate watch mode