Skip to content

A prank I pulled on my engineering team for April Fools' Day in 2021, involving a deliberately loosely-typed TypeScript script. πŸ˜‚

Notifications You must be signed in to change notification settings

kyleget/whateverscript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WhateverScript

A loosely-typed companion to TypeScript.

Installation

npm install whateverscript

Usage

Basic Usage

Integrating WhateverScript into your project is easy! Just import Whatever, and immediately see its power.

import type Whatever from 'whateverscript';

function foo(bar: Whatever): Whatever {
  return `Hello ${bar}!`;
}

Advanced Usage

You can also quickly convert existing typed objects by either explicitly setting the Whatever type or by using the makeWhatever utility function.

// foo.ts
export const helloWorld: IntrinsicAttributes & InferPropsInner<Pick<{ myProp }> & Requireable<(...args)> = 'Hello World!';

// bar.ts
import { helloWorld } from './foo';
import Whatever, { makeWhatever } from 'whateverscript;


const myHelloWorld1: Whatever = helloWorld as Whatever;  // Hello World!

const myHelloWorld2: Whatever = makeWhatever(helloWorld);  // Hello World!

Other Usage

WhateverScript works with any data type... even Date objects!

import { makeWhatever } from 'whateverscript;
const now = new Date();

makeWhatever(now); // 2021-04-01T00:00:00Z

About

A prank I pulled on my engineering team for April Fools' Day in 2021, involving a deliberately loosely-typed TypeScript script. πŸ˜‚

Resources

Stars

Watchers

Forks

Packages

No packages published