INNER CODE UNIT · TypeScript
getPrefOrDefault
zuplo/zudoku · packages/create-zudoku/index.ts:223
const getPrefOrDefault = (field: string) =>
preferences[field] ?? defaults[field];
if (!opts.typescript && !opts.javascript) {
if (skipPrompt) {
// default to TypeScript in CI as we can't prompt to
// prevent breaking setup flows
opts.typescript = getPrefOrDefault("typescript");
} else {
const styledTypeScript = blue("TypeScript");
const { typescript } = await prompts(
{
type: "toggle",
name: "typescript",
message: `Would you like to use ${styledTypeScript}?`,
initial: getPrefOrDefault("typescript"),
active: "Yes",
inactive: "No",