normalizeExtension = function (ext) {
    // Class/Object submission, use extension object
    if (typeof ext === 'function' || (typeof ext === 'object' && ext.extension)) {
        if (!ext.extension) {
            throw new Error('Extension class must have an extension object');
        }
        var metadata = (typeof ext.extension !== 'object')
            ? { type: ext.extension }
            : ext.extension;
        ext = __assign(__assign({}, metadata), { ref: ext });
    }
    if (typeof ext === 'object') {
        ext = __assign({}, ext);
    }
    else {
        throw new Error('Invalid extension type');
    }
    if (typeof ext.type === 'string') {
        ext.type = [ext.type];
    }
    return ext;
}
Convert input into extension format data.
@ignore