Comments (7)
I think that would be ideal, as it's unlikely Node will perfectly fit into an ECMAscript standard in the near future.
As far as I'm aware, it's not possible to use lib.es6.d.ts
without fully targeting ES6/ES2015 in the compiler options . This has the issue that some ES2015 features which aren't supported by Node 4.x (such as default arguments), aren't transpiled back to ES5, so causes an error when run on Node 4.
I'll have an experiment with trying to merge the modular ES2015 lib definitions into node.d.ts
and will create a PR if I find something useful.
from env-node.
Things get tricky here, since it's technically provided by TypeScript if you enable lib.es6.d.ts
.
One thing I'm interested in is whether we want something that works with pure noLib
, I do think that would be great.
from env-node.
So the problem we have here, which is the reason why this will probably be done in a separate version/variation of the node typings and not the main one, is that you might get conflicts and break things for users who would use target: es7
.
It's the same issue when using es6-promise
typings with target: es6
. It simply breaks your build and you can do nothing about it.
I'd love to see typescript allowing conflicts like that, but in the mean time, this will have to be in a separate declarations file probably called node-nolib
or something.
We can still <reference />
the original file in the nolib
version though.
Related: #1
from env-node.
That's a good point and it probably means this won't be fully solvable until microsoft/TypeScript#4692 is complete, to allow targetting platforms between ES versions in the TS compiler.
However, that issue is still at proposal stage and doesn't have a milestone release target, so I believe it would be useful to have an intermediate solution.
My thoughts are, if you are developing for Node.JS 4.3, you should target ES5 (the highest fully supported ES version, without any harmony options). You then use a node env definition to help fill in the gaps between ES5 and Node 4.3 (e.g., polyfills, collections).
As harmony options become core features across different minor versions, these definitions would need to target minor versions, as opposed to just targeting 4.x.
I'm not sure whether this solution belongs in this particular repository though, or in a repository called node-es5
(or similar), which depends on node@4
.
Any thoughts on this idea?
from env-node.
I know the problem with TS now, and why Console
worked but Error
didn't.
Everything in interface Console
was a function. Typescript has no problems with functions as it treats them as overloads. But anything else (read: attributes) becomes a problem.
I've added interfaces for Map
/Set
etc in map-set branch. The only important thing that's missing is Map#size
and if we find a workaround for it everything else should be fine.
from env-node.
Actually, I found a workaround.
from env-node.
We should also add Object.assign()
to Node 5.
from env-node.
Related Issues (20)
- process.stdout should be WritableStream | tty.WriteStream HOT 23
- Object.assign is missing in node 4/5/6 typings HOT 6
- Provide interface PipeOptions instead of { end?: boolean }
- (Re)export ReadWriteStream interface in 'stream' external module HOT 1
- Expose types from `ts-node`
- "connected" property missing from ChildProcess in Node 4.x and below HOT 1
- Error.stackTraceLimit is number in node6? HOT 1
- "exitCode" property missing on NodeJS.process
- Kill `http.ServerRequest` type
- extend type define of NodeJS.Process.env HOT 12
- util.inspect() does not accept {depth: null} with strictNullChecks
- declare `fs.Stats` as a class
- url.format() does not accept string
- What happened to TlsOptions? HOT 1
- readFileSync `options` can be null HOT 2
- Old definitions in registry HOT 2
- Broken with newest es6.lib.d.ts HOT 3
- Add secureOptions to https.createServer options
- 7.0.8 Breaks when used with @types/Core-js HOT 3
- Wrong vm.createContext signature HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from env-node.