* @param context
* @returns
*/
-export function createContext<P extends T, T extends object>(parentContext: P, context: T): P extends null ? T : P & T {
+export function createContext<T extends object>(parentContext: null, context: T): T;
+export function createContext<T extends object, P extends T>(parentContext: P, context: T): P & T;
+export function createContext(parentContext: object, context: object) {
return Object.assign(Object.create(parentContext), context);
}
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)) {
-import { ChartDataset } from '../../src/types.js';
+import type { ChartDataset } from '../../src/types.js';
const dataset: ChartDataset = {
data: [10, null, 20],
}
}
-declare module '../..' {
+declare module '../../index.js' {
interface CartesianScaleTypeRegistry {
test: {
options: TestScaleOptions
import {
Chart, ChartData, ChartConfiguration, Element
-} from '../../src/types';
+} from '../../src/types.js';
const data: ChartData<'line'> = { datasets: [] };
const chartItem = 'item';
-import { LayoutPosition } from '../../../src/types.js';
+import type { LayoutPosition } from '../../../src/types.js';
const left: LayoutPosition = 'left';
const right: LayoutPosition = 'right';
-import { ParsedDataType } from '../../src/types.js';
+import type { ParsedDataType } from '../../src/types.js';
interface test {
pie: ParsedDataType<'pie'>,
-import { ChartDataset } from '../../../../src/types.js';
+import type { ChartDataset } from '../../../../src/types.js';
const dataset: ChartDataset = {
data: [],
Title,
SubTitle,
Tooltip
-} from '../../src/types';
+} from '../../src/types.js';
Chart.register(
ArcElement,
-import { ChartOptions } from '../../../src/types.js';
+import type { ChartOptions } from '../../../src/types.js';
const chartOptions: ChartOptions<'line'> = {
scales: {
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'
}
},
-import { ChartType, Scriptable, ScriptableContext } from '../../src/types.js';
+import type { ChartType, Scriptable, ScriptableContext } from '../../src/types.js';
interface test {
pie?: Scriptable<number, ScriptableContext<'pie'>>,
-import { ChartConfiguration } from '../../src/types.js';
+import type { ChartConfiguration } from '../../src/types.js';
const getConfig = (): ChartConfiguration<'bar'> => {
return {
{
"extends": "../../tsconfig.json",
"compilerOptions": {
- "noEmit": true
+ "noEmit": true,
+ "rootDir": "../../"
},
"include": [
"../",
"../../src/",
"../../dist/**/*.d.ts"
+ ],
+ "exclude": [
+ "./**/*.js"
]
}