Skip to content

Instantly share code, notes, and snippets.

View orta's full-sized avatar
🥂

Orta Therox orta

🥂
View GitHub Profile
@orta
orta / index.md
Last active June 16, 2024 12:13
Prisma include fragments

To make sure I am explicit on the fragments (I know you, Jan, know this, but bypassers will read too) in GraphQL + Relay you can write a React DOM like

query root
  - fragment A 
  - fragment B
  - fragment C

and the query gets compiled by relay to make a single request, and then each fragment only gets the data it requested (even though it was part of a larger query of data)

@orta
orta / pong.lua
Created April 23, 2022 17:50
A trivial version of pong for the playdate
import "CoreLibs/sprites"
import "CoreLibs/graphics"
playdate.display.setRefreshRate(20)
local gfx = playdate.graphics
local spritelib = gfx.sprite
local screenWidth = playdate.display.getWidth()
local screenHeight = playdate.display.getHeight()
@orta
orta / example.d.ts
Last active December 9, 2021 15:27
html-lang-tester
export type ABC = {
one: 123
}
@orta
orta / 0 ~ Intro.md
Last active March 14, 2023 01:53
Type | Treats 2020

The Challenge

Welcome to TypeScript's first ever set of virtual code challenges: Type | Treat (or "Type or Treat")! We will be presenting some "spooky" code challenges that will allow you to get deeper into the TypeScript language but in a fun way.

Starting tomorrow, a new code challenge will be posted every weekday, along with its solution the day after. The last solution will be posted on Halloween day.

Are The Challenges For TypeScript Developers Only?

Absolutely not! We want all developers, familiar with TypeScript or not to be apart of Type | Treat. Every day will have two different types of challenges, one for beginners/learners and one for intermediate/advanced developers. That way everyone can participate.

@orta
orta / rfc.md
Last active February 20, 2024 02:23
A proposal for improving TS2322 error messages

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 September 6, 2021 10:25
Ideas for TSC with prettier pretty settings - click raw on this svg below
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@orta
orta / gist:dd0868bc8cd780f4ac81aaf30e7f8d34
Created May 20, 2021 17:03
index.d.ts file lengths on DT
[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 February 5, 2021 15:55
Upload GitHub Action
name: Upload infra
on:
push:
branches:
- main
- prod
jobs:
build-and-deploy:
@orta
orta / files.sh
Created January 26, 2021 15:42
Number of html files in the TypeScript website
❯ 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 December 6, 2020 13:51
A simple snowpack plugin for generating a .d.ts file for paths inside an asset folder
// @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) {