-
Notifications
You must be signed in to change notification settings - Fork 64
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
Requires declaration #184
Comments
To my knowledge import syntax (as opposed to just require) is idiomatic in TypeScript, yeah. Looks like they're doing the following: declare namespace PIXI {
...
}
declare namespace pixi {
export const gl: typeof PIXI.glCore;
}
//tslint:disable-next-line:no-single-declare-module
declare module "pixi.js" {
export = PIXI;
} We're doing this: declare var R: R.Static;
declare namespace R {
...
}
export = R; I'm not sure exactly how you're using these typings or TS if not using imports -- I'm trying to figure out whether the behavior you're looking for is caused by their It's hard for me to verify my guess as I don't know how to reproduce your use-case. Would it be possible for you to try adding such a module declaration in your local ramda typings copy to verify what might fix this for you? I apologize I'm not too knowledgeable in this area. |
It seems the |
Thanks, I tried adding that now. I'm guessing this means the functions would need to be declared/exported from the top level as well though? |
|
Great! If @dakom can confirm this as working I guess we're good then. :) |
hmm with latest commit I'm still getting |
@dakom can you share some steps to reproduce? |
From this work-in-progress repo: sodium-typescript-playground If you comment out the declare const R, then you get the error (to run the repo, after |
OK, seems it's more of a general typescript issue: microsoft/TypeScript#10178 |
UMD is considered no In this case, (tsconfig.json) {
"include": [
"../src/**/*.ts",
"../types/*" // <----
],
} (./types/ramda.d.ts) import * as _R from 'ramda';
declare global {
const R: typeof _R; // <-- set R as global variable
} @dakom As you mentioned, it currently not considered UMD as global variable, we have nothing to do for this issue, since we can't declare |
Yep - your solution fixed it, thanks :-D |
fwiw, VSCode is acting strange with it... compiles and completes fine, but VSCode still hilights the usage with an error/warning :\ |
might VSCode not be using the same TS version? That's one possibility, though I think I've otherwise seen discrepancies as well... pretty weird. |
@dakom you have to put your EDIT: There's probably no option for that. |
ugh... now I tried it in a different project and got more errors again. I think I'm going to forget about trying to use it as a global, adding a |
@dakom yeah, I do wish we had global imports as well. |
Closing as not having ways to solve this makes it sorta non-actionable; if we do find a way then let's retry. |
Using the R typings requires adding a
declare const R;
at the top of the file, or importing RIs this expected behavior? I don't encounter that with other packages which I need typings for but only import at runtime via cdn (e.g. PIXI)
The text was updated successfully, but these errors were encountered: