On Mon, Oct 1, 2012 at 7:00 PM, Alexey Petrushin <[email protected]
> wrote:

> > It'd be a great idea to write up a TypeScript header file for the API
> surface in Node.
>
> Can't it be done with plain js? Something like this
>
>     // Implementation file.
>     fs.readFile = function(name, callback){...}
>
>     // Header file with types.
>     fs.untypedReadFile = fs.readFile
>     fs.readFile = function(name, callback){
>       if(!_(name).isString()) throw new Error("name should be a string!")
>       fs.untypedReadFile(name, callback)
>     }
>
> --
>

An imperative "assertion" is not the same as simply ensuring that your
actual code only ever passes a value of a single specific type.

Rick







> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to