typetype
typetype copied to clipboard
Create a webpack loader
Create a webpack loader so integration in build chain and existing projects is straight-forward.
This way it would be possible to use it like this:
// src/parseURL.type
type function parseURL = (text) => ^{
if (parseProtocol<text> extends [infer protocol, infer rest]) {
return {
protocol,
rest
}
} else {
return never
}
}
// src/my-app.ts
import type { parseURL } from './parseURL.type';
const parseURLImpl: parseURL = () => ...;