Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions scripts/generate-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,7 @@ async function generateMarksApi() {
details.push('', '```ts', typeDef, '```');
}
if (!details.length) continue;
resolvedTypeSections.push([`### ${typeName}`, '', ...details].join('\n'));
resolvedTypeSections.push([`### ${String(typeName)}`, '', ...details].join('\n'));
}

const typeSection = resolvedTypeSections.length
Expand Down Expand Up @@ -1066,7 +1066,7 @@ async function generateTransformsApi() {
const refDetail = resolveTypeDetail(refName, sourceFile, localStringUnionMap);
if (!refDetail) continue;
if (explainedTypes.has(refName)) {
usedLinks.push(`[${refName}](/api/transforms#${slugify(refName)})`);
usedLinks.push(`[${String(refName)}](/api/transforms#${slugify(refName)})`);
continue;
}
const expanded = expandTypeRecursive(refName, sourceFile, localStringUnionMap);
Expand Down
2 changes: 1 addition & 1 deletion scripts/visual-regression.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ Failed:
${failures.map((x) => `${gray(`- ${x.shortRoute} ${x.mode} `)}${failText}`).join('\n')}

Running:
${[...running].map((r) => `${gray(`- `)}${r} ${spinner[frame % spinner.length]} ${gray(((Date.now() - jobStarted.get(r)) / 1000).toFixed(1) + 's')}`).join('\n')}
${[...running].map((r) => `${gray(`- `)}${String(r)} ${spinner[frame % spinner.length]} ${gray(((Date.now() - jobStarted.get(r)) / 1000).toFixed(1) + 's')}`).join('\n')}
`);
};
let i = setInterval(renderRunning, 80);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/helpers/autoScales.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ export function autoScaleColor({
const newDomain: any[] = Object.keys(schemeObj);
// for every value in domain that's not part of the scheme, map to unknown
for (const v of domain) {
const key = String(v);
const key = String(v as string | number | boolean);
if (schemeObj[key] == null) {
newDomain.push(key);
newScheme.push(unknown);
Expand Down
4 changes: 2 additions & 2 deletions src/lib/marks/helpers/trail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export function trailPath(
}
}

return typeof context.toString === 'function' ? context.toString() : undefined;
return typeof context.toString === 'function' ? (context as Path).toString() : undefined;
}

// Round caps: original capsule behavior.
Expand Down Expand Up @@ -231,7 +231,7 @@ export function trailPath(
ready = false;
}

return typeof context.toString === 'function' ? context.toString() : undefined;
return typeof context.toString === 'function' ? (context as Path).toString() : undefined;
}

function resampleCurve(
Expand Down
2 changes: 1 addition & 1 deletion src/lib/marks/helpers/waffle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,6 @@ export function maybeRound(
): (x: number) => number {
if (round === undefined || round === false) return Number;
if (round === true) return Math.round;
if (typeof round !== 'function') throw new Error(`invalid round: ${round}`);
if (typeof round !== 'function') throw new Error(`invalid round: ${String(round)}`);
return round;
}
4 changes: 2 additions & 2 deletions src/lib/transforms/map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@ function maybeMap(map: MapMethod): MapIndexObject {
if (map == null) throw new Error('missing map');
if (typeof map === 'object' && typeof map.mapIndex === 'function') return map;
if (typeof map === 'function') return mapFunction(map);
switch (`${map}`.toLowerCase()) {
switch ((map as string).toLowerCase()) {
case 'cumsum':
return mapCumsum;
case 'rank':
return mapFunction((I, V) => Array.from(rank(I, (i: number) => V[i])));
case 'quantile':
return mapFunction((I, V) => rankQuantile(I, (i) => V[i]));
}
throw new Error(`invalid map: ${map}`);
throw new Error(`invalid map: ${map as string}`);
}

function rankQuantile(I: number[], f: (i: number) => any): number[] {
Expand Down
4 changes: 2 additions & 2 deletions src/lib/transforms/normalize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function normalize(options: NormalizeOptions): MapIndexObject {
if (basis === undefined) return normalizeFirst;
if (typeof basis === 'function') return normalizeBasis(basis);
// if (/^p\d{2}$/i.test(basis)) return normalizeAccessor(percentile(basis));
switch (`${basis}`.toLowerCase()) {
switch ((basis as string).toLowerCase()) {
case 'deviation':
return normalizeDeviation;
case 'first':
Expand All @@ -65,7 +65,7 @@ function normalize(options: NormalizeOptions): MapIndexObject {
case 'extent':
return normalizeExtent;
}
throw new Error(`invalid basis: ${basis}`);
throw new Error(`invalid basis: ${basis as string}`);
}

function normalizeBasis(basis: BasisFunction): MapIndexObject {
Expand Down
4 changes: 3 additions & 1 deletion src/lib/transforms/stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ function stackXY<T>(
[FACET]:
groupFacetsBy.length > 0
? groupFacetsBy
.map((channel) => String(resolveChannel(channel, d as any, channels)))
.map((channel) =>
String(resolveChannel(channel, d as any, channels) as string | number)
)
.join('---')
: 'F',
[S[byDim]]: resolveChannel(byDim, d as any, channels)
Expand Down