Vega-lite: Type Error due to `clone` dependencies

Created on 18 Jan 2019  路  11Comments  路  Source: vega/vega-lite

/Users/kanitw/Documents/code/tune-vis/node_modules/vega-lite/build/src/util.d.ts
(1,8): Module '"/Users/kanitw/Documents/code/tune-vis/node_modules/@types/clone/index"' has no default export.

Most helpful comment

Yeah, you might need to add

"allowSyntheticDefaultImports": true

I don't know whether we can change it easily but I'm not opposed to changing things.

All 11 comments

What's your tsconfig?

I think you add automatically converting non-default export to default export in Vega-Lite.

I could do the same for now, but I don't think it makes sense for us to expect that all users of Vega-Lite have to adjust the config to be like us.

Yeah, you might need to add

"allowSyntheticDefaultImports": true

I don't know whether we can change it easily but I'm not opposed to changing things.

If we want to remove "allowSyntheticDefaultImports": true from Vega-Lite, we have to make the following change:

-import clone_ from 'clone';
+import clone_ = require('clone');

However, we will get the following error:

{
    "resource": "/Users/kanitw/Documents/code/vega-lite/src/util.ts",
    "owner": "typescript",
    "code": "1202",
    "severity": 8,
    "message": "Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"', 'import d from \"mod\"', or another module format instead.",
    "source": "ts",
    "startLineNumber": 1,
    "startColumn": 1,
    "endLineNumber": 1,
    "endColumn": 34
}

So nope, we can't change it easily ><"

I think the problem is the way clone is written. Is it a big deal to require "allowSyntheticDefaultImports": true?

I guess it's probably okay, but it's not nice. It's better if we don't enforce build configuration on dependent projects because it's contagious.
Say library A depends on VL, then any library that depends on A needs this config too.

I agree it's a noble goal but I don't think it's the highest priority.

I am having this exact problem. When I add "allowSyntheticDefaultImports": true the problem disappears but my compile time increases by more than double the usual time. Is there any other way to fix this?

@israeltq There probably is but we don't have time to look into this. If you find a solution, please send us a pull request.

Hi
Is this change available in latest version?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kanitw picture kanitw  路  4Comments

paintdog picture paintdog  路  4Comments

mcnuttandrew picture mcnuttandrew  路  3Comments

kanitw picture kanitw  路  3Comments

ijlyttle picture ijlyttle  路  3Comments