-
-
Notifications
You must be signed in to change notification settings - Fork 59
Module references and category methods in .d.ts-es #562
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
Comments
I understand the pros of your proposal, but just want to hear your opinion on the drawbacks. Separating category methods from the actual class declaration means that if you use a category method from TS you have to know which module it comes from and reference it explicitly. This may be tedious in some cases especially when you are converting native code to TypeScript and you are expecting that all you need to do is copy -> paste -> nativescriptify :). PS: I have no strong opinion on the topic, just trying to understand what is the motivation behind your proposal and see all the pros and cons. |
Users will be able to add all Due to categories I think at the moment Foundation must reference half the iOS framework (see the top references in https://github.com/PanayotCankov/nativescript-big-dts/blob/split/ios/objc!Foundation.d.ts) |
This is a branch, using the ios-runtime .d.ts generator, that references UIKit and its dependencies. I had to remove some category methods to limit the dependencies and add It has a tsconfig references files as:
The compilation time is:
And this is the same project that builds all
The |
The benefit from categories may not be that big since some of the frameworks forward declare classes from other frameworks :( So there are still quite a lot of dependencies. And UIKit pulls a lot. But adding |
@PanayotCankov Thanks for the valuable info, I am adding this issue to the backlog. |
Declare the extension methods in the modules where they are declared.
Declare
/// <reference path="" />
references for dependencies.For example:
objc!Foundation.d.ts
objc!CoreGraphics.d.ts
The methods still can be used as:
index.d.ts
This will decouple the frameworks a lot, a client app can reference just a small portion of the iOS run-time exposed APIs. Currently Foundation and UIKit have types from CoreGraphics, CoreAudio etc. added thorough categories.
The text was updated successfully, but these errors were encountered: