-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Publish on NPM #9
Comments
You need to refactor the definition to be in a different format when you're writing an external module. The common pattern is to use a namespace. See something like https://github.com/types/npm-passport-twitter/blob/master/lib/strategy.d.ts and https://github.com/typings/typings/blob/master/docs/examples.md#function--utility for more information. |
However, that comment was based on the fact I looked at your export function pick (...): void;
export interface X {} Instead of doing a namespace or interface directly as the export. |
I think I already tried that, but resulting JS did not work (because of a way require call was compiled). The problem is I need to default export an object of type Also I originally wanted to cover whole Sanctuary - default form from require and also a customized form from I am a TypeScript beginner, so if you think you are right please provide more details. |
Yes, you can - use a namespace and see this comment: #9 (comment).
How are you requiring it? From the docs, the exports were correct so I'd guess the import might be incorrect. From a definition point of view, it means exactly the same thing to do |
When I have some time I might look at it and try again, but I am not very keen to toy with it too much (I have already rewritten whole typings from namespace to interface once, definitely won't do it again). I have already spent in total over 3 work days (didn't know much about TS when I started), which I probably won't get paid for, just to get it working so I can use it at work (I am not planning on using it nor TS in my toy projects). In the current form it works - solution with a local package is good-enough for me and if this typings gets eventually pulled into sanctuary repo then I don't have to change a thing (typings repo has some requirements at least on formatting and tests), so this project at its current state is not very high on my personal todo list. If you or anyone else would like to try to change it I would gladly accept PRs. |
Note to myself: Try |
maybe |
Similar topic: typed-typings/npm-ramda#96
Investigate if it is even possible - this project uses two type files, mainly to circumvent limitations of TypeScript. I suspect it is not, because when I tried to use this repo by typings tool (it supports github as a source), it concatenated all files - essentially hiding all sanctuary types (like
Maybe
and others). 😞The text was updated successfully, but these errors were encountered: