Logo Xantham

Spec Module

The facts and mappings every shaping pass is written against: what a resolved type *is* (literal, tuple, callback, branded primitive, constructor object, tagged union), the F# reference it maps to, its declared type parameters, and shared member and signature shaping.

Functions and values

Function or value Description

bindingOf export

Full Usage: bindingOf export

Parameters:
Returns: ImportBinding

How a harvested value binds in JavaScript. An ambient global is already on `globalThis`, so it takes `[]`; a module export carries an import, and an ambient module's export carries the specifier its declaration quotes.

export : HarvestedExport
Returns: ImportBinding

defaultExportName ctx

Full Usage: defaultExportName ctx

Parameters:
Returns: string

The fallback name for a default export - `Naming.defaultExport` over the entry package.

ctx : Context
Returns: string

fsName fallback export

Full Usage: fsName fallback export

Parameters:
Returns: string

The F# name a harvested export generates under: the exported name; a default export takes its declaring symbol's name - except `export default function name` binds the symbol itself as `default`, which falls back to the package-derived name.

fallback : string
export : HarvestedExport
Returns: string

literalOf facts

Full Usage: literalOf facts

Parameters:
Returns: FsLiteral option

The literal payload of a literal type, when the response carries one.

facts : TypeFacts
Returns: FsLiteral option

optionalRef optional reference

Full Usage: optionalRef optional reference

Parameters:
Returns: FsTypeRef

An optional member or parameter reads as `option`, one level deep however the optionality arrived (a `?` marker, an `undefined` union member, or both).

optional : bool
reference : FsTypeRef
Returns: FsTypeRef

typeRef ctx model self owner typeId

Full Usage: typeRef ctx model self owner typeId

Parameters:
Returns: FsTypeRef * Finding list

The F# type written at a reference position, with the findings any widening produces. `self` is the name of the declaration being shaped, so a polymorphic `this` return resolves to it. A type carries several flags at once, so the arm order below picks which finding.

ctx : Context
model : ShapeModel
self : string option
owner : string
typeId : int
Returns: FsTypeRef * Finding list

uniqueCaseNames names

Full Usage: uniqueCaseNames names

Parameters:
    names : string list

Returns: string list

Case names must be unique within one DU; a later duplicate takes a numeric suffix in member order, deterministically.

names : string list
Returns: string list

Type something to start searching.