feathers icon indicating copy to clipboard operation
feathers copied to clipboard

Add typescript definitions

Open pspeter3 opened this issue 12 years ago • 20 comments

Has anyone asked for Typescript definitions or tried using feathers with Typescript? I'm tempted to make them but unsure if they're actually wanted.

pspeter3 avatar May 16 '14 19:05 pspeter3

Not that I am aware of. If you wanted to add definitions that would be great. I personally haven't done much Typescript if you want to submit an example we'll definitely add it to the readme.

ekryski avatar Jun 13 '14 03:06 ekryski

Closing for now due to inactivity on this subject. I'm also not much of a typescript user. Will reopen if it becomes a more requested feature.

ekryski avatar Jul 17 '14 17:07 ekryski

Typescript is now a pretty solid product. Having typings for feathers would be nice.

omeid avatar Mar 23 '16 03:03 omeid

@talensjr Maybe interested to help out? :)

omeid avatar Mar 23 '16 03:03 omeid

It will definitely need to be community driven. No one on the core team currently uses Typescript. If someone wants to take on the challenge I'll re-open the issue and we can slot it into a milestone.

ekryski avatar Mar 23 '16 04:03 ekryski

Yes I would like to help, I don't know how much time can I spend on it right now, but sure I will try to help out

talensjr avatar Mar 23 '16 10:03 talensjr

Ok re-opening and renaming. @omeid and @talensjr I'm going to pass the baton to you guys on this.

ekryski avatar Mar 23 '16 14:03 ekryski

I will try to give this a crack and see how it goes.

omeid avatar Mar 24 '16 02:03 omeid

This may be fairly quick to add to https://github.com/DefinitelyTyped/DefinitelyTyped. It can probably just extend the Express definitions from the same repository and then add the definitions for the API. It probably also makes sense to add definitions for the service interface.

daffl avatar Apr 11 '16 01:04 daffl

I just added this to the next release which is currently set for July 15th. @omeid please let me know if you or anybody else can take this on until then.

daffl avatar Apr 13 '16 01:04 daffl

Hi @daffl,

Unfortunately I am pretty caught up with work and can't look into this any time soon.

omeid avatar Apr 13 '16 03:04 omeid

I'm going to leave this open and on the milestone until it gets closer to the release date in case anybody else is interested in picking this up. It seems to be fairly doable for anybody familiar with TypeScript interfaces.

daffl avatar Apr 13 '16 04:04 daffl

Of course we will do everything we can to help anybody who would like to contribute TypeScript definitions but I am going to close this issue since it does not look like anybody is going to pick it up.

daffl avatar Jun 10 '16 01:06 daffl

I'd really like to have this as well, because webstorm can't analyse the package this is probably because of your bundling with babel webstorm says that i.e. app.configure is an undefined function

looking for community stubs http://definitelytyped.org/

I'm not using Typescript itself, but it's still annoying to have everything underlined

ForsakenHarmony avatar Dec 04 '16 21:12 ForsakenHarmony

Bundling with Babel shouldn't really make a difference. Maybe it can't statically analyze it because of the way it is added to the app. Webstorm usually also takes JSDocs into consideration (which we don't publish either though).

Either way, the open issue for TypeScript definitions is https://github.com/feathersjs/feathers/issues/381. Apparently making TypeScript definitions is really really hard because everybody keeps asking for them but nobody seems to be able to actually make it happen :trollface:

daffl avatar Dec 05 '16 05:12 daffl

The issue is that maintaining them requires keeping the definitions and the code base in sync which is not always obvious.

pspeter3 avatar Dec 05 '16 19:12 pspeter3

@daffl write typescript definitions is hard, because this is:

A way of making explicit what is implicit.

I had to study a lot of source code and documentation to make this:#381

AbraaoAlves avatar Jan 17 '17 02:01 AbraaoAlves

How I can program with typescript in featherjs?

alejandrohn avatar Jun 19 '17 16:06 alejandrohn

Here's part of a Slack discussion:

alehn [11:56 AM] it's possible feathers with typescript?

smixx [12:11 PM] https://github.com/feathersjs/feathers-typescript, none of us on the core team use TypeScript so they are maintained by the community

alehn [12:28 PM] how use typescript?

harmony [12:31 PM] wait, do you want to use feathers with typescript but don't know how typescript works?

alehn [12:36 PM] yes I know with typescript work , That's why I'm asking how I programn in feathers with ts

[12:37] or I have to program with es6 obligatory

eddyystop [12:39 PM] @alehn .d.ts files are fundamental to TypeScript https://blog.mariusschulz.com/2014/05/19/using-typescripts-type-definition-files-to-get-tooling-support-for-plain-javascript#utilizing-type-definition-files-for-plain-javascript Marius Schulz Using TypeScript's Type Definition Files to Get Tooling Support for Plain JavaScript TypeScript's type definition files are great to describe the public interface of JavaScript libraries. Here's how you can use them to get autocompletion and documentation for plain JavaScript code using Visual Studio and ReSharper. May 19th, 2014 at 7:17 PM

(edited)

[12:40] There is a whole ecosystem for them https://github.com/DefinitelyTyped/DefinitelyTyped

alehn [12:40 PM] somewhere is using typescript in feathers? .ts

alehn [12:51 PM] I use angular 4 for frontend and I need use feather for backend for web service but I have programming with ts and I dont want put js

eddyystop [12:52 PM] Your choice then is using the .d.ts. It is a perfectly satisfactory, perfectly accepted way to use TypeScript. Hundreds of packages are delivered like this.

[12:54] I assume you will have inline TypeScript definitions for your own code, so you'll have to run a build step before executing your server code. (edited)

alehn [1:00 PM] no I use webpack

[1:01] I programing in ts only

bazaglia [1:36 PM] joined #general

j2l4e [1:38 PM] @alehn the current ts definitions are a work in progress. If you want everything to just work, delete any *.d.ts files in node-modules/feathers* and put declare module feathers; declare module feathers-*; in your typings.d.ts file. It doesn't get you intellisense, but makes it work (edited)

[1:39] how do you escape the asterisk in markdown?

teddy-error [1:40 PM]

alehn [1:40 PM] thanks

j2l4e [1:41 PM] if you are into fiddling... the typings generally work, but there may be some packages that would need you to remove their definitions and put a wildcard definition in place

[1:42] so you can try out what works for you

[1:43] That aside, you should have a look at typescripts 'allowJS' setting, that was introduced recently. It should allow you to work with TS and JS files side-by-side regardless of the availability of definitions

eddyystop avatar Jun 19 '17 18:06 eddyystop

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue with a link to this issue for related bugs.

lock[bot] avatar Feb 07 '19 13:02 lock[bot]