diff --git a/src/helpers/helpers.options.ts b/src/helpers/helpers.options.ts
index 3ee1b55f21a..0cd38e4d7d6 100644
--- a/src/helpers/helpers.options.ts
+++ b/src/helpers/helpers.options.ts
@@ -203,6 +203,8 @@ export function _addGrace(minmax: { min: number; max: number; }, grace: number |
* @param context
* @returns
*/
-export function createContext
(parentContext: P, context: T): P extends null ? T : P & T {
+export function createContext(parentContext: null, context: T): T;
+export function createContext(parentContext: P, context: T): P & T;
+export function createContext(parentContext: object, context: object) {
return Object.assign(Object.create(parentContext), context);
}
diff --git a/types/tests/autogen.js b/types/tests/autogen.js
index e3479834136..cd8768a7330 100644
--- a/types/tests/autogen.js
+++ b/types/tests/autogen.js
@@ -10,7 +10,7 @@ let fd;
try {
const fn = path.resolve(__dirname, 'autogen_helpers.ts');
fd = fs.openSync(fn, 'w+');
- fs.writeSync(fd, 'import * as helpers from \'../../dist/helpers\';\n\n');
+ fs.writeSync(fd, 'import * as helpers from \'../../dist/helpers/index.js\';\n\n');
fs.writeSync(fd, 'const testKeys: unknown[] = [];\n');
for (const key of Object.keys(helpers)) {
diff --git a/types/tests/dataset_null_data.ts b/types/tests/dataset_null_data.ts
index b63344db17d..9b02635ad5b 100644
--- a/types/tests/dataset_null_data.ts
+++ b/types/tests/dataset_null_data.ts
@@ -1,4 +1,4 @@
-import { ChartDataset } from '../../src/types.js';
+import type { ChartDataset } from '../../src/types.js';
const dataset: ChartDataset = {
data: [10, null, 20],
diff --git a/types/tests/extensions/scale.ts b/types/tests/extensions/scale.ts
index c02871c4eb8..712b3f15ca5 100644
--- a/types/tests/extensions/scale.ts
+++ b/types/tests/extensions/scale.ts
@@ -17,7 +17,7 @@ export class TestScale extends Sc
}
}
-declare module '../..' {
+declare module '../../index.js' {
interface CartesianScaleTypeRegistry {
test: {
options: TestScaleOptions
diff --git a/types/tests/interaction.ts b/types/tests/interaction.ts
index 46de29b6c4d..234a98bda98 100644
--- a/types/tests/interaction.ts
+++ b/types/tests/interaction.ts
@@ -1,6 +1,6 @@
import {
Chart, ChartData, ChartConfiguration, Element
-} from '../../src/types';
+} from '../../src/types.js';
const data: ChartData<'line'> = { datasets: [] };
const chartItem = 'item';
diff --git a/types/tests/layout/position.ts b/types/tests/layout/position.ts
index cc0e8be67ee..10233d681a7 100644
--- a/types/tests/layout/position.ts
+++ b/types/tests/layout/position.ts
@@ -1,4 +1,4 @@
-import { LayoutPosition } from '../../../src/types.js';
+import type { LayoutPosition } from '../../../src/types.js';
const left: LayoutPosition = 'left';
const right: LayoutPosition = 'right';
diff --git a/types/tests/parsed.data.type.ts b/types/tests/parsed.data.type.ts
index a4de0aaf305..86f34c102a5 100644
--- a/types/tests/parsed.data.type.ts
+++ b/types/tests/parsed.data.type.ts
@@ -1,4 +1,4 @@
-import { ParsedDataType } from '../../src/types.js';
+import type { ParsedDataType } from '../../src/types.js';
interface test {
pie: ParsedDataType<'pie'>,
diff --git a/types/tests/plugins/plugin.filler/fill_target_true.ts b/types/tests/plugins/plugin.filler/fill_target_true.ts
index 6e9553da9d7..057dbecf7df 100644
--- a/types/tests/plugins/plugin.filler/fill_target_true.ts
+++ b/types/tests/plugins/plugin.filler/fill_target_true.ts
@@ -1,4 +1,4 @@
-import { ChartDataset } from '../../../../src/types.js';
+import type { ChartDataset } from '../../../../src/types.js';
const dataset: ChartDataset = {
data: [],
diff --git a/types/tests/register.ts b/types/tests/register.ts
index ddc5f5e24dc..e844ab8a4a7 100644
--- a/types/tests/register.ts
+++ b/types/tests/register.ts
@@ -24,7 +24,7 @@ import {
Title,
SubTitle,
Tooltip
-} from '../../src/types';
+} from '../../src/types.js';
Chart.register(
ArcElement,
diff --git a/types/tests/scales/chart_options.ts b/types/tests/scales/chart_options.ts
index 8694aa9f7e3..fc5c20e6886 100644
--- a/types/tests/scales/chart_options.ts
+++ b/types/tests/scales/chart_options.ts
@@ -1,4 +1,4 @@
-import { ChartOptions } from '../../../src/types.js';
+import type { ChartOptions } from '../../../src/types.js';
const chartOptions: ChartOptions<'line'> = {
scales: {
diff --git a/types/tests/scales/options.ts b/types/tests/scales/options.ts
index 086435b6e7b..2b186d79917 100644
--- a/types/tests/scales/options.ts
+++ b/types/tests/scales/options.ts
@@ -19,14 +19,13 @@ const chart = new Chart('test', {
unit: 'year'
},
ticks: {
- stepSzie: 1
+ stepSize: 1
}
},
x1: {
- // @ts-expect-error Type '"linear"' is not assignable to type '"timeseries" | undefined'.
type: 'linear',
+ // @ts-expect-error 'time' does not exist in 'linear' options
time: {
- // @ts-expect-error Type 'string' is not assignable to type 'false | "millisecond" | "second" | "minute" | "hour" | "day" | "week" | "month" | "quarter" | "year" | undefined'.
unit: 'year'
}
},
diff --git a/types/tests/scriptable.ts b/types/tests/scriptable.ts
index 607fe8cffb4..89c40d894b8 100644
--- a/types/tests/scriptable.ts
+++ b/types/tests/scriptable.ts
@@ -1,4 +1,4 @@
-import { ChartType, Scriptable, ScriptableContext } from '../../src/types.js';
+import type { ChartType, Scriptable, ScriptableContext } from '../../src/types.js';
interface test {
pie?: Scriptable>,
diff --git a/types/tests/scriptable_core_chart_options.ts b/types/tests/scriptable_core_chart_options.ts
index 87b3bbe5e08..b638505525c 100644
--- a/types/tests/scriptable_core_chart_options.ts
+++ b/types/tests/scriptable_core_chart_options.ts
@@ -1,4 +1,4 @@
-import { ChartConfiguration } from '../../src/types.js';
+import type { ChartConfiguration } from '../../src/types.js';
const getConfig = (): ChartConfiguration<'bar'> => {
return {
diff --git a/types/tests/tsconfig.json b/types/tests/tsconfig.json
index 48c8ae8c360..438b3b48fd0 100644
--- a/types/tests/tsconfig.json
+++ b/types/tests/tsconfig.json
@@ -1,11 +1,15 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
- "noEmit": true
+ "noEmit": true,
+ "rootDir": "../../"
},
"include": [
"../",
"../../src/",
"../../dist/**/*.d.ts"
+ ],
+ "exclude": [
+ "./**/*.js"
]
}