typescript.api icon indicating copy to clipboard operation
typescript.api copied to clipboard

import lib.d.ts should be in the module

Open Vadorequest opened this issue 10 years ago • 2 comments

Hi.

I started to use your module today, it works well unlike the https://npmjs.org/package/typescript-require library which don't works at all.

But, it's tricky and it took me some time (okay, 5 minutes) but I think you should autamtically add a reference to lib.d.ts, maybe select the path (static) in a config file? I don't know, but it could save some time to not add it in each file because your error validation print errors like Object/JSON types are undefined, they are really basics and it should be ok without include this script.

By the way, I wanted to thank you for this module so, thank you.

Vadorequest avatar Nov 27 '13 00:11 Vadorequest

Hiya, and you're welcome :D

I have been considering re-adding lib.d.ts by default. However for some historical context, below are some of the reasons for its removal.

  • There were considerable performance issues with the 0.9.0 release of TypeScript. (However, Microsoft have since vastly improved compiler performance in recent releases.)
  • A effort to keep the type declarations lean when developing in the context of node.js (less declarations means less types to check against which means better performance). Compare this with the vast amount of browser specific declarations found in lib.d.ts.
  • Boost performance on my derivative web project which is making heavy use of the api. Located here if you are interested.

So, after a few months in the wild, and using the API on a lot of the projects (both browser and nodejs), i too have found it a bit cumbersome to reference lib.d.ts (or node.d.ts), within the project itself. So yes, bringing it back is a good thing :)

re-adding lib.d.ts

What i would like to do is re add lib.d.ts (as a default), but also allow a developer to compile for a target environment. So something along the following lines


var tsapi = require('typescript.api')

tsapi.reset({
      environment : 'browser' // browser (default) | nodejs | ecma | phantomjs |  etc
})

The above of course would correspond to the declarations bundled along with the npm module. see here

You should know though, that I will unable to find time to make this update before the end of the year due to other commitments, so I am planning on holding off on updates to this project till early January. To be honest, I was hoping to make this update along with the official release of TS 1.0 but given the demand for this, (and the slowness of the 1.0 release), expect this update before that :)

Thanks heaps for the feedback :)

Sinclair

sinclairzx81 avatar Nov 27 '13 07:11 sinclairzx81

Oh, looked really easy to me but I see there are some issues, I understand very well why it's not a default. (lib.d.ts) Appex looks interesting, I think you should add a working demo/source code, could be useful. (People like to see something working and have a better overview to see the design and so on)

Thank you for the explanations, I understand better now. I'll keep adding the reference until the next release then! ;)

2013/11/27 sinclairzx81 [email protected]

Hiya, and you're welcome :D

I have been considering re-adding lib.d.ts by default. However for some historical context, below are some of the reasons for its removal.

There were considerable performance issues with the 0.9.0 release of TypeScript. (However, Microsoft have since vastly improved compiler performance in recent releases.)

A effort to keep the type declarations lean when developing in the context of node.js (less declarations means less types to check against which means better performance). Compare this with the vast amount of browser specific declarations found in lib.d.ts. -

Boost performance on my derivative web project which is making heavy use of the api. Located here https://github.com/sinclairzx81/appexif you are interested.

So, after a few months in the wild, and using the API on a lot of the projects (both browser and nodejs), i too have found it a bit cumbersome to reference lib.d.ts (or node.d.ts), within the project itself. So yes, bringing it back is a good thing :) re-adding lib.d.ts

What i would like to do is re add lib.d.ts (as a default), but also allow a developer to compile for a target environment. So something along the following lines

var tsapi = require('typescript.api') tsapi.reset({ environment : 'browser' // browser (default) | nodejs | ecma | phantomjs | etc})

The above of course would correspond to the declarations bundled along with the npm module. see herehttps://github.com/sinclairzx81/typescript.api#declarations

You should know though, that I will unable to find time to make this update before the end of the year due to other commitments, so I am planning on holding off on updates to this project till early January. To be honest, I was hoping to make this update along with the official release of TS 1.0 but given the demand for this, (and the slowness of the 1.0 release), expect this update before that :)

Thanks heaps for the feedback :)

Sinclair

— Reply to this email directly or view it on GitHubhttps://github.com/sinclairzx81/typescript.api/issues/10#issuecomment-29363998 .

Cordialement,

M. Ambroise Dhenain.

Vadorequest avatar Nov 27 '13 07:11 Vadorequest