import { Swagger } from "@atlassian/atlassian-openapi"; /** * `typeof null === 'object'` in JavaScript, and `@atlassian/atlassian-openapi`'s * own type-checking helpers rely on `typeof x === 'object'` to mean "a real * object I can index into" -- so every one of them throws on `null` instead of * returning `false` (see ai-planning/40-proposal-null-safe-document-walking.md * §2.1). A `null` reaches here whenever a structural slot -- a Schema, an * Operation, a Parameter -- is left empty in the source document (a YAML key * with nothing written after it): technically invalid OpenAPI, but an easy * mistake to make and, before this module existed, one that produced a raw * `TypeError` pointing into a dependency rather than into the input. * * Every `TC.*` call this codebase makes goes through the wrapped version here * instead, so a `null` in a structural slot always becomes one clear, typed * error naming what was expected -- see proposal 40 §3b for why this errors * rather than silently skipping the slot or fabricating a stand-in. */ export declare class MalformedDocumentError extends Error { readonly expected: string; readonly pointer?: string | undefined; constructor(expected: string, pointer?: string | undefined); } /** Throws {@link MalformedDocumentError} for `null`; passes everything else through, including `undefined`. */ export declare function required(value: T | null, expected: string, pointer?: string): T; export declare function isReference(s: unknown, pointer?: string): s is Swagger.Reference; /** * Unlike the other three wrapped here, `TC.isMediaTypeWithExamples` has no * `typeof` guard at all (`'examples' in t`) -- it throws on `null`, * `undefined`, and every primitive, not just `null`. `required()`'s narrower * `=== null` check would leave `undefined`/primitives unguarded, so this one * checks the wider condition itself instead of delegating to `required()`. */ export declare function isMediaTypeWithExamples(t: unknown, pointer?: string): t is Swagger.MediaTypeWithExamples; export declare function isParameterWithSchema(p: unknown, pointer?: string): p is Swagger.ParameterWithSchema; export declare function isHeaderWithSchema(o: unknown, pointer?: string): o is Swagger.HeaderWithSchema; //# sourceMappingURL=safe-type-checks.d.ts.map