IFClite TypeScript API
    Preparing search index...

    Function withNarrowedCoordinateSpace

    • Earn the narrowed type on a freshly parsed wire object: drop a mesh_coordinate_space that is not one of the three tiers, say so, and hand the object back with the field RETYPED, so a caller can wrap its JSON.parse in place and get a value the compiler agrees about.

      The return type is the point, not decoration. JSON.parse hands back any and a hand-written wire interface can carry the field as string; returning the argument's own T would hand that straight back and the caller would still be holding a string the type system believes.

      Intersection rather than Omit, and that is not a style choice: Omit is NOT distributive, so applied to a union it collapses to the shared keys and a caller holding ParquetParseResponse | OptimizedParquetParseResponse would lose every property the two do not share. An intersection distributes ((A | B) & X is (A & X) | (B & X)), and string & MeshCoordinateSpace reduces to the union, so the field comes out narrowed and the rest of the shape comes out untouched.

      MUTATES wire and returns that same object: it is called on what this client just built from JSON.parse, so mutating in place is cheaper than copying a response that carries every mesh, and the object is not shared with anyone yet. A caller passing an object it keeps a second reference to sees the field disappear from both, and a frozen object throws. Deleting rather than assigning undefined keeps "the server sent nothing" and "the server sent something unusable" indistinguishable to a consumer, which is what the type says.

      Type Parameters

      • T extends { mesh_coordinate_space?: unknown }

      Parameters

      • wire: T

      Returns T & { mesh_coordinate_space?: "site_local" | "model_rtc" | "raw_ifc" }