-
Notifications
You must be signed in to change notification settings - Fork 16
Closed
Description
In the following example, the playground does not report any error, despite TypeScript knowing that liveWith may be undefined, leading to a runtime error. We need to enable strictNullChecks at minimum.
export default defineInstrument({
...,
content: {
liveWith: {
kind: 'set',
label: {
en: 'Who do you currently live with? (Check all that apply)',
fr: "Avec qui habitez-vous présentement? (Cochez toutes les réponses qui s'appliquent)"
},
variant: 'listbox',
options: {
en: {
alone: 'Alone',
spouse: 'With spouse or partner',
family: 'Family member(s)',
friends: 'Friend(s)',
community: 'Members of a community',
other: 'Other (please specify)'
},
fr: {
alone: 'Seul(e)',
spouse: 'Avec votre conjoint',
family: 'Avec un ou des membres de votre famille',
friends: 'Avec un ou des amis',
community: "Membres d'une communauté",
other: 'Autre (veuillez préciser)'
}
}
},
liveWithSpecify: {
kind: 'dynamic',
deps: ['liveWith'],
render: ({ liveWith }) => {
if (!liveWith.has('other')) {
return null;
}
return {
kind: 'string',
label: {
en: 'Please specify:',
fr: 'Veuillez préciser:'
},
variant: 'input'
};
}
}
},
...
});Metadata
Metadata
Assignees
Labels
No labels