const myOutput: Output = {
ContactId: input.Contact__c,
Email: input.ContactEmail__c,
IsInternalUpdate: true,
Preferences: mypreferences
}
(property) Output.ContactId: string Type 'unknown' is not assignable to type 'string'.ts(2322) Output.ts(4, 5): The expected type comes from property 'ContactId' which is declared here on type 'Output' if (input[prefCode] !== null) {
currentValue = input[prefCode].toString();
}
in the lines above, I see a red underline under input[prefCode] import { Output } from "./Output";
import { Preference } from "./Preference";
export function MyMap(input: unknown): Output {
const mypreferences = Array<Preference>();
for (const prefCode in input) {
if (prefCode.endsWith("__c")) {
if (prefCode === "IsInternalUpdate__c") {
continue;
}
let currentValue = "";
if (input[prefCode] !== null) {
currentValue = input[prefCode].toString();
}
if (currentValue === "true") {
currentValue = "True";
}
if (currentValue === "false") {
currentValue = "False";
}
const preference: Preference = {
PrefCode: prefCode,
CurrentValue: currentValue
}
mypreferences.push(preference);
}
}
const myOutput: Output = {
ContactId: input.Contact__c,
Email: input.ContactEmail__c,
IsInternalUpdate: true,
Preferences: mypreferences
}
return myOutput;
}
https://aka.ms/nohello
which redirects(?) to
https://sbmueller.github.io/nohello/