vega/vega-tooltip

Simplified version import caused a breaking change

hans-pragt opened this issue · 4 comments

When version 0.23.1 of this package is included, and --resolveJsonModule has not been specified in the project using this package, the typescript compiler will throw the following error:

ERROR in node_modules/vega-tooltip/build/src/index.d.ts:1:25 - error TS2732: Cannot find module '../package.json'. Consider using '--resolveJsonModule' to import module with '.json' extension

1 import { version } from '../package.json';

Note that in our package.json file, we don't explicitly include vega-tooltip, we are on version 6.9.0 of vega-embed.

Arg, sorry about that. I didn't think that it would break modules. I have to revert the change then. Stay tuned.

No worries, it was easy to figure out.

Ahh, it looks like the issue is that typescript generates different declarations.

after:

import { version } from '../package.json';  // HERE
import { View } from 'vega-typings';
import { Options } from './defaults';
import { Handler } from './Handler';
export * from './defaults';
export * from './formatValue';
export * from './position';
export * from './Handler';
export { version };
/**
 * Create a tooltip handler and register it with the provided view.
 *
 * @param view The Vega view.
 * @param opt Tooltip options.
 */
export default function (view: View, opt?: Options): Handler;
//# sourceMappingURL=index.d.ts.map

before:

import { View } from 'vega-typings';
import { Options } from './defaults';
import { Handler } from './Handler';
declare const version: string;  // HERE
export * from './defaults';
export * from './formatValue';
export * from './position';
export * from './Handler';
export { version };
/**
 * Create a tooltip handler and register it with the provided view.
 *
 * @param view The Vega view.
 * @param opt Tooltip options.
 */
export default function (view: View, opt?: Options): Handler;
//# sourceMappingURL=index.d.ts.map

Fixed in 7275f53