-
-
Notifications
You must be signed in to change notification settings - Fork 95
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
Using typescript with Sanctuary? #531
Comments
Should it be |
|
Oh well, thanks for your help. |
That is the problem. This works: import * as S from 'sanctuary';
interface Maybe<A> {
constructor: {
'@@type': 'sanctuary/Maybe';
};
}
const parseNumber = (v: string): Maybe<number> => {
const n = parseInt(v, 10);
return isNaN(n) ? S.Nothing : S.Just(n);
}; I don't know whether it's possible to import the |
Cool, will do. |
Running into the same issue. Was this ever resolved? |
I'm no TypeScript expert, @elie222. Does the following work for you? interface Maybe<A> {
constructor: {
'@@type': 'sanctuary-maybe/Maybe@1';
};
} |
That didn't work for me, but the following did: interface Maybe<A> {
'@@type': 'sanctuary/Maybe';
} |
I guess I'm wondering if I'm doing something foolish here? I'm just getting errors when I try to specify my types. Eg,
This highlights the
S
inS.Maybe
saying "Cannot find namespace 'S'"I also tried importing the specific things:
... and that says "Cannot find name 'Maybe'."
If I change everything to
any
, it works fine, so Sanctuary is there & working, but not the types.Versions in package.json:
The text was updated successfully, but these errors were encountered: