Creating TypeScript Declaration Files
and Contributing to DefinitelyTyped
or
What to Do
When TypeScript goes wrong
Joe Skeen
Intermountain Healthcare
Currently
in top 100
contributor to DefinitelyTyped (of over 2300)
TypeScript Usually Just Works
Once you get it set up
Cases Where Typings May Be Wrong
Typings are wrong (contradict the documentation)
Typings are incomplete (missing documented functionality or options)
Typings aren't exposing something you need (like an options interface)
No typings exist
Examples
Incorrect
https://github.com/DefinitelyTyped/DefinitelyTyped/pull/6156/files
Incomplete
https://github.com/ivogabe/gulp-typescript#options
https://github.com/Microsoft/TypeScript/wiki/What%27s-new-in-TypeScript#new---skiplibcheck
Not Exposed
https://github.com/klei/gulp-inject
Nonexistant
https://github.com/miickel/gulp-angular-templatecache
How to Fix This
Identify the source of the error
lib.d.ts
- Microsoft/TypeScript project
Bundled Typings - Respective Project (comes with NPM package)
External Typings -
DefinitelyTyped
,
Typings Registry
,
Typed Typings
Fix it
Submit pull request(s)
DefinitelyTyped
A great example of an open-source community
How to contribute
Log into GitHub (or create an account)
Fork DefinitelyTyped and clone
Make fixes
Write tests
Test the fixes with
npm test
Push your changes to the fork
Set up Travis build
https://travis-ci.org/
Open a pull request
DefinitelyTyped Contribution Guide
Let's do this!
Add an option to the gulp-typescript option
https://github.com/ivogabe/gulp-typescript#options
https://github.com/Microsoft/TypeScript/wiki/What%27s-new-in-TypeScript#new---skiplibcheck
Expose Options interface on gulp-inject
https://github.com/klei/gulp-inject
Create definitions for gulp-angular-templatecache
https://github.com/miickel/gulp-angular-templatecache
If at first you don't succeed...
Now it's your turn!
Slides:
joeskeen.github.io/dts-OpenWest2016
Review this talk:
https://joind.in/talk/bf5d7
More Resources
Example code:
github.com/joeskeen/ngExamples
(mars-ts folder)
Official Declaration File Authoring Guide (TypeScript 2.0 Version of TypeScript Handbook)
TypeScript Handbook (where the above guide will someday be published)
DefinitelyTyped Contriubution Guide
'Typings' Contribution Guide (for the Typings Registry)
OpenWest Conference 2016
July 13-16 2016
South Towne Expo Center