...
...
ts-blank-space
tags: TypeScript, type erasure, type stripping
As part of my work on the JavaScript Tooling team at Bloomberg I have implemented an experimental (not yet used in production) package to transform TypeScript into JavaScript using a somewhat novel approach.
This is a description of what I learned from implementing the idea. The source code will be open sourced soon - it just needs some regular IP approval.
This is a living document. Everything in this document is made in good faith of being accurate, but like I just said; we don't yet know everything about what's going on.
Update: I've disabled comments as of 2025-01-26 to avoid everyone having notifications for something a year on if someone wants to suggest a correction. Folks are free to email to suggest corrections still, of course.
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks. | |
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/) | |
(() => { | |
const SHOW_SIDES = false; // color sides of DOM nodes? | |
const COLOR_SURFACE = true; // color tops of DOM nodes? | |
const COLOR_RANDOM = false; // randomise color? | |
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com) | |
const MAX_ROTATION = 180; // set to 360 to rotate all the way round | |
const THICKNESS = 20; // thickness of layers | |
const DISTANCE = 10000; // ¯\\_(ツ)_/¯ |
/** | |
* @param {import("@11ty/eleventy/src/UserConfig")} eleventyConfig | |
*/ | |
module.exports = (eleventyConfig) => { | |
return {}; | |
}; |
{ | |
"explorer.experimental.fileNesting.enabled": true, | |
"explorer.experimental.fileNesting.patterns": { | |
"*.ts": "$(capture).js, $(capture).d.ts, $(capture).test.ts", | |
"*.js": "$(capture).js.map, $(capture).min.js, $(capture).d.ts, $(capture).test.js", | |
"*.jsx": "$(capture).js", | |
"*.tsx": "$(capture).ts, $(capture).*.ts, $(capture).*.tsx", | |
"tsconfig.json": "tsconfig.*.json", | |
"docker-compose.yml": "docker-compose.*.yml", | |
".env": ".env.*", |
":" //#;exec /usr/bin/env node --input-type=module - $@<$0 | |
import process from 'process' | |
const { argv } = process | |
console.log(argv) |
let NETWORK_PRESETS = { | |
'GPRS': { | |
'offline': false, | |
'downloadThroughput': 50 * 1024 / 8, | |
'uploadThroughput': 20 * 1024 / 8, | |
'latency': 500 | |
}, | |
'Regular2G': { | |
'offline': false, | |
'downloadThroughput': 250 * 1024 / 8, |
// This is Node script that uses Puppeteer (headless Chrome) to measure the decode time | |
// of a single image injected into a blank HTML document. It uses minimist to take command | |
// line arguments. Example usage: node measure-image-decode.js https://example.com/example-image.jpg | |
// This example assumes you're running a local server to grab the blank document. | |
// Thanks to Paul Irish and Tim Kadlec for their input! | |
const puppeteer = require("puppeteer"); | |
const argv = require("minimist")(process.argv.slice(2)); | |
async function getDecode(url) { |