Open jmagaram opened 6 years ago
Going crazy here. I really want to use your library. Looks like a lot of care went into making it. I like the dot-free extensible notation and that it is built using Typescript and has lots of good docs. But I can't get going with it at all. After adding to package.json, I would expect these lines to work but errors about "has no exported member filter". Try it here: code sandbox
import { filter as flt } from 'starry.filter' import { groupBy as grp } from 'starry.group-by' const x = flt([1,2,3,4,5],i=>i!==2);
import filter = require('starry.filter')
is the correct syntax right now, but I've been thinking about exporting a default and named export instead as that works better in VSCode. 🤔
In a TypeScript file in VS code import filter = require('starry.filter')
gives me...
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.
Then I tried this...
import { filter } from 'starry.filter';
And got this...
Module '"c:/Users/justi/source/repos/gtd/node_modules/starry.filter/index"' has no exported member 'filter'.
You're targeting es6 as your output module format. You can either switch to commonjs modules in your tsconfig.json or use the import * as ns from 'module'
format.
Looks like there's a bug specific to groupBy
.
Have you managed to fix this? You can check the tests to see how the function is being imported.
I added this to package.json...
What is easiest way to add to my TypeScript files? I've tried this...
And it all auto-completes and does IntelliSense fine, EXCEPT for red squiggly under the GroupBy import. I get this error...
Module '"c:/Users/justi/source/repos/gtd/node_modules/starry.group-by/index"' resolves to a non-module entity and cannot be imported using this construct.
Not sure why groupBy gives a problem but the other ones work fine. Also, it is tedious to import each function that way. Is there a shorthand? I'm just learning TypeScript.