Skip to content
This repository has been archived by the owner on Nov 20, 2018. It is now read-only.

Usage in TypeScript - Angular 2 based projects #1688

Closed
singhjusraj opened this issue Nov 9, 2016 · 11 comments
Closed

Usage in TypeScript - Angular 2 based projects #1688

singhjusraj opened this issue Nov 9, 2016 · 11 comments

Comments

@singhjusraj
Copy link
Member

Type of issue

feature request

Uploader type

All

Feature request details

Just started using this library and it is a very solid one with many great features.
I'm trying to integrate with TypeScript in Angular 2 project.
I've read the documentation about how to import as ES6 modules.

the typescript compiler complaints if I use import qq from 'fine-uploader' because there isn't any index file in the root of the library which would export anything as a typical Typescript settings.

if I do let qq = require('fine-uploader'), things work fine, but I need to use import rather than require to be able to generate rollup bundle later.

Detailed description of the feature

As Angular is very popular Front end framework, it will be great if we're able to use FineUploader with ease.
I can understand that you have less time for features like these.
I'm very new to this library as I just started playing around with it and I have less knowledge about the core functions and the file structure.
What needs to be done here is to add TypeScript definition files and have named exports for all the modules.
You have already done something very similar for react-fine-uploader
I'm not sure how much work will it require for Angular 2 - TypeScript Compatibility.

Let me know your thoughts on it and I'll be happy to help If I can.

@rnicholus
Copy link
Member

Related to #1652?

@singhjusraj
Copy link
Member Author

Yes, it's related to #1652
In addition to having typescript definitions, also needed is class declarations and named exports from common index.d.ts file.

A good example to that is angular2-highcharts library, which is just a handful of typescript wrappers for the original commonJS Highcharts library and works perfectly with Angular 2. If you look at their dist directory, all it contains is just handful or file which have class declarations and named exports for all the different components.

I know this probably is a low priority task for you. I can help to get this done, but I have very little knowledge about fine-uploader library

@rnicholus
Copy link
Member

I'm afraid I'm not the best person to implement this feature for a few reasons:

  1. I'm not familiar with Angular 2 (I used Angular 1 in previous projects, but have since moved to React).
  2. I'm not familiar enough with Typescript, though it's on my list of tech to investigate.
  3. As you mentioned, there are a number of other cases higher up on my list.

That said, I do see how this would be a very valuable update to Fine Uploader. I'm willing to provide advice and answer questions at any time if you are willing to participate in coding this up.

I see creating TS definition for the API to be a fair amount of work. See the API nav menu at http://docs.fineuploader.com - I assume all events, methods, and options will need to be covered in the TS definitions.

As for the wrapper, as you mentioned, something similar to what I created for React Fine Uploader sounds like the right approach. More specifically, the "wrapper classes" I created are probably a good high-level model.

@singhjusraj
Copy link
Member Author

Sure I'll definitely give it a shot as me and my team definitely want to use this library instead of any other.
I looked over the options and methods in the API and I'll start preparing a TS definition file.

How do I contact you for advice, questions and overall progress?

@rnicholus
Copy link
Member

Since this is a public project, I'd like to maintain as much transparency as possible. So feel free to post any questions at all in this issue. If that isn't working out for some reason, we can regroup and discuss another approach.

@singhjusraj
Copy link
Member Author

This repo contains the first draft that I've prepared today which includes declarations for CORE and UI methods.
I'll keep adding more to it.
You can have a look if you want.

@rnicholus
Copy link
Member

cool. i'll take a closer look this weekend. or perhaps i should wait until you are "done" with this definitions file, then I can add comments.

This might work better as a pull request to Fine Uploader. You can commit to the branch associated with the PR as you complete this, and I can comment on commits much easier.

@singhjusraj
Copy link
Member Author

Ok I can do that. I'm not sure how to create a pull request and push my changes

@rnicholus
Copy link
Member

First step is to fork the project. Then you can submit a pull request using GitHub after you push your first commit to your branch. Subsequent commits to your branch will be part of this pull request. It will be much easier to discuss changes and plans in that context.

@singhjusraj
Copy link
Member Author

Closing this issue since we have PR #1719

@rnicholus
Copy link
Member

Think #1652 can be closed too...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants