fix(compiler): generate inputs with aliases properly (#26774)

PR Close #26774
This commit is contained in:
Kara Erickson
2018-10-25 23:05:15 -07:00
committed by Matias Niemelä
parent c048358cf9
commit 19fcfc3d00
10 changed files with 69 additions and 24 deletions

View File

@ -532,12 +532,15 @@ function stringAsType(str: string): o.Type {
return o.expressionType(o.literal(str));
}
function stringMapAsType(map: {[key: string]: string}): o.Type {
const mapValues = Object.keys(map).map(key => ({
key,
value: o.literal(map[key]),
quoted: true,
}));
function stringMapAsType(map: {[key: string]: string | string[]}): o.Type {
const mapValues = Object.keys(map).map(key => {
const value = Array.isArray(map[key]) ? map[key][0] : map[key];
return {
key,
value: o.literal(value),
quoted: true,
};
});
return o.expressionType(o.literalMap(mapValues));
}