Spec
module Spec| Assembly | Xantham.Generator |
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.
Declared inside
CompiledSignature | Signatures as .NET overload resolution compares them: abbreviations expanded at every depth and a signature's own type variables renamed by position |
Functions and values
abbreviations (decls: FsDecl list) : Map<string,FsTypeRef>
abbreviations (decls: FsDecl list) : Map<string,FsTypeRef>Type abbreviations declared by a model, as name -> target. Shared by the passes that must compare signatures the way the compiler does: .NET overload resolution sees through an abbreviation, so TargetsParam and the U6<...> it abbreviates are one type to it.
bindingOf (export: HarvestedExport) : ImportBinding
bindingOf (export: HarvestedExport) : ImportBindingHow a harvested value binds in JavaScript. An ambient global is already on globalThis, so it takes [<Global>]; a module export carries an import, and an ambient module's export carries the specifier its declaration quotes.
defaultExportName (ctx: Context) : string
defaultExportName (ctx: Context) : stringThe fallback name for a default export - Naming.defaultExport over the entry package.
expandAbbreviations (abbrevs: Map<string,FsTypeRef>) (visited: Set<string>) (reference: FsTypeRef) : FsTypeRef
expandAbbreviations (abbrevs: Map<string,FsTypeRef>) (visited: Set<string>) (reference: FsTypeRef) : FsTypeRefA reference with abbreviations expanded. visited breaks a cycle a malformed declaration set could otherwise spin on; it is threaded rather than global so nested positions of one reference each get their own budget.
fsName (fallback: string) (export: HarvestedExport) : string
fsName (fallback: string) (export: HarvestedExport) : stringThe 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.
hasIncompatibleOverloadedTypeParameters (model: ShapeModel) (facts: TypeFacts) : bool
hasIncompatibleOverloadedTypeParameters (model: ShapeModel) (facts: TypeFacts) : boolAn object type whose call signatures hoist a shared type-parameter name under two different bounds — the F# head produced by aliasTypeParams is unwritable.
memberTypeRef (ctx: Context) (model: ShapeModel) (self: string option) (owner: string) (member_: ResolvedMember) : FsTypeRef * Finding list
memberTypeRef (ctx: Context) (model: ShapeModel) (self: string option) (owner: string) (member_: ResolvedMember) : FsTypeRef * Finding listPreserves direct source string-alias annotations without capturing unannotated interned unions.
nestUnder (owner: string) (segment: string) : string
nestUnder (owner: string) (segment: string) : stringThe name a shape reached at segment of owner declares under: Widget and Options give Widget.Options, which render-source writes as type Options inside module Widget. The result carries a dot only where both ends take the identifier shape a module opens under; a JavaScript key like beta channel concatenates and stays one backticked name.
reservedCaseNames: Set<string>
reservedCaseNames: Set<string>F# identifiers a bare single-case [<StringEnum>] case collides with if written without RequireQualifiedAccess: the core library's own single-case union members.
typeParamsOf (ctx: Context) (model: ShapeModel) (owner: string) (ids: int<typeId> list) : FsTypeParam list * Map<int<typeId>,string> * Finding list
typeParamsOf (ctx: Context) (model: ShapeModel) (owner: string) (ids: int<typeId> list) : FsTypeParam list * Map<int<typeId>,string> * Finding listA declaration's own type parameters, and the scope its members must be shaped under. Both come from one walk so they agree: a member may reference exactly the parameters that earn a name. A constraint survives only where it maps to a named type; extends keyof T drops.
typeRef (ctx: Context) (model: ShapeModel) (self: string option) (owner: string) (typeId: int<typeId>) : FsTypeRef * Finding list
typeRef (ctx: Context) (model: ShapeModel) (self: string option) (owner: string) (typeId: int<typeId>) : FsTypeRef * Finding listThe 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.
typeScriptLiteral (literal: FsLiteral) : string
typeScriptLiteral (literal: FsLiteral) : stringThe TypeScript spelling of a literal: 2, 0.5, "method".