Many of the more "advanced" typescript features can be used for creating "value-derived" types.
At its simplest form:
let vehicle = { name: "Van", wheels: 4 }| /** | |
| * Get the minimum distance from a point P to a line with a segment AB. | |
| * @param A The start of the line. | |
| * @param B The end of the line. | |
| * @param P A point. | |
| * @returns | |
| */ | |
| export function distanceToLine(A: number[], B: number[], P: number[]) { | |
| const delta = sub(B, A) | |
| const angle = Math.atan2(delta[1], delta[0]) |
| DMCA Takedown Notice | |
| == Copyright owner: Kakao Corp. | |
| == Name: An Chisu | |
| == Company: Kakao Corp. | |
| == Job title: IP Manager | |
| == Email address: trademark@kakaocorp.com | |
| == Address: 7F N, H-Square, 235 | |
| == City: Pangyoyeok-ro, Bundang-gu, Seongnam-si |
⚠️ Warning: this document is out of date.For the most recent webpack5 instructions see MIGRATION.md.
Storybook 6.2 includes experimental Webpack 5 support. Webpack 5 brings a variety of performance improvements, as well as exciting new features like module federation. Here's a quick guide to get you going.
| import { promises } from "fs"; | |
| import crypto from "crypto"; | |
| import path from "path"; | |
| import { print, parse } from "graphql"; | |
| const plugin = { | |
| name: "relay", | |
| setup: build => { | |
| build.onLoad({ filter: /\.tsx$/, namespace: "" }, async args => { | |
| let contents = await promises.readFile(args.path, "utf8"); |
| declare interface CSS { | |
| layoutWorklet: Worklet // eslint-disable-line no-undef | |
| paintWorklet: Worklet // eslint-disable-line no-undef | |
| animationWorklet: Worklet // eslint-disable-line no-undef | |
| } | |
| declare type ChildDisplay = "block" | "normal" | |
| declare type LayoutSizingMode = "block-like" | "manual" | |
| declare interface LayoutOptions { |
| /* | |
| * credit to Dhrumil Shah (@wandcrafting) and Robert Haisfield (@RobertHaisfield) | |
| * for the original concept which was part of their RoamGames submission | |
| * and can be found at: https://www.figma.com/file/5shwLdUCHxSaPNEO7pazbe/ | |
| * | |
| */ | |
| /* ======= OPTIONS ======== */ | |
| /* note: if you change these, reload the page to see the effect */ |
Note: This announcement is related to today's batch of released
urqlpackages. You can see the release process and the changelogs here: urql-graphql/urql#1340
We have an entirely new release batch that we've just worked on. This batch includes some breaking changes and major releases, so we'd like to take a moment to talk about what has changed. It will luckily be surprisingly unsurprising and builds on the work that's already been ongoing for a while. Lastly we'll include a note on our upcoming roadmap, which we'll be kicking off soon.
| <!-- | |
| When an input element gets focused, iOS Safari tries to put it in the center by scrolling (and zooming.) | |
| Zooming can be easily disabled using a meta tag, but the scrolling hasn't been quite easy. | |
| The main quirk (I think) is that iOS Safari changes viewport when scrolling; i.e., toolbars shrink. | |
| Since the viewport _should_ change, it thinks the input _will_ move, so it _should_ scroll, always. | |
| Even times when it doesn't need to scroll—the input is fixed, all we need is the keyboard— | |
| the window always scrolls _up and down_ resulting in some janky animation. | |
| However, iOS Safari doesn't scroll when the input **has opacity of 0 or is completely clipped.** |