// @ts-check /** @enum {string} */ const types = [ "root", "header", "headerSignature", "headerVersion", "logicalScreenDescriptor", "logicalScreenWidth", "logicalScreenHeight", "logicalScreenDescriptorPackedFields", "logicalScreenBackgroundColorIndex", "logicalScreenPixelAspectRatio", "globalColorTable", "globalColorTableColor", "imageSection", "imageDescriptor", "imageSeparator", "imageDescriptorLeftPosition", "imageDescriptorTopPosition", "imageDescriptorWidth", "imageDescriptorHeight", "imageDescriptorPackedFields", "localColorTable", "localColorTableColor", "imageData", "imageDataLzwMinimumCodeSize", "imageDataSubBlock", "imageDataSubBlockSize", "imageDataSubBlockData", "imageDataTerminator", "extensionBlockIntroducer", "extensionBlockSize", "unknownExtensionBlock", "unknownExtensionBlockLabel", "unknownExtensionBlockData", "gifTerminator", ].reduce((result, id) => { result[id] = id; return result; }, Object.create(null)); // TODO: Revert this and just export the thing export const GifNodeType = new Proxy(types, { get(target, prop) { const result = target[prop]; if (!result) { throw new Error(`cannot get ${String(prop)}`); } return result; }, });