0.2.0 • Published 3 years ago

@axel-hq/fddtsc v0.2.0

Weekly downloads
-
License
Unlicense
Repository
-
Last release
3 years ago

fddtsc

foundatsion declaration typescript file compiler

usage

ffaq (fake frequently asked questions)

This, here, is the compiler magic that makes newtypes disappear within d.ts files.

transform calls //!

Leading comments (comments directly above a type) trigger type transforms.

  • foundatsion::newtype: every reference to this type is replaced with unknown.
  • foundatsion::unwrap: every reference to this type is replaced with it's first type argument.
  • foundatsion::bake: this type's simplification is baked into the output.
// @file example.ts

//! foundatsion::unwrap
type bar<baz> = never;
type reverse_string<s extends string> =
   s extends `${infer head}${infer tail}`
      ? `${reverse_string<tail>}${head}`
      : "";

export type so = bar<"shouldn't this be never?">;
//! foundatsion::bake
export type baked = reverse_string<"Hello, World!">;
// @file example.d.ts
export type so = "shouldn't this be never?";
export type baked = "!dlroW ,olleH";

for Reasons We Do Not Fully Understand, neither newtype nor unwrap work all the time

for developers

  1. make install
  2. make build
  3. make install (again to install what you just built into the test)
  4. make test
0.2.0

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago

0.0.0

3 years ago