mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-17 07:20:23 +00:00
ae4e55ab1a33d5dd55170578e00f78f308d7fe24
In TypeScript 0.8.1.1, a 'declare' is needed in front of the 'class Spinner', since without it the compiler attempts to compile it as an actual class definition, and fails with:
Message: Overload declaration lacks definition
Line number: 27
Column number: 5
Source error:
Line 26: class Spinner {
Line 27: constructor (options?: SpinnerOptions);
-------------^
Line 28: spin(target?: any);
The test in the typescript codebase that confirms this is intentional behavior is in tests/compiler/class.ts
http://typescript.codeplex.com/SourceControl/changeset/view/2bee84410e02#tests/compiler/class.ts
****
describe('Testing function signatures inside classes', function () {
it('Regression test - was previously giving runtime error', function () {
var code = "class A { a(completed: () => any): void; }";
Harness.Compiler.compileString(code, 'fnsig-inside-classes', function (result) {
assert.compilerWarning(result, 1, 10, 'Overload declaration lacks definition');
assert.equal(result.errors.length, 1);
});
});
});
****
The compiler code that implements the check is in src/compiler/signatures.ts
http://typescript.codeplex.com/SourceControl/changeset/view/2bee84410e02#src/compiler/signatures.ts
****
if (!hasConstruct && !this.definitionSignature && this.signatures[i].declAST && this.signatures[i].declAST.isOverload && !hasFlag(this.signatures[i].declAST.fncFlags, FncFlags.Ambient)) {
checker.errorReporter.simpleError(this.signatures[i].declAST, "Overload declaration lacks definition");
}
****
By adding the 'declare', we tell the TypeScript compiler that this is just intending to expose the API of the class, not the actual implementation.
The expires option can be either a number or a Date object. (https://github.com/carhartl/jquery-cookie#expires)
DefinitelyTyped
TypeScript type definitions repository for popular JavaScript libraries.
The project aims to provide high quality definitions for the most popular libraries out there.
Complete
- AngularJS (by Diego Vilar) (wiki)
- async (by Boris Yankov)
- Backbone.js (by Boris Yankov)
- Bootstrap (by Boris Yankov)
- bootstrap.datepicker (by Boris Yankov)
- Breeze (by Boris Yankov)
- CodeMirror (by François de Campredon)
- Chosen (by Boris Yankov)
- Chrome (by Matthew Kimber)
- dynatree (by François de Campredon)
- d3.js (from TypeScript samples)
- EaselJS (by Pedro Ferreira)
- ember.js (by Boris Yankov)
- Express (by Boris Yankov)
- Fancybox (by Boris Yankov)
- Foundation (by Boris Yankov)
- GoogleMaps (by Esben Nepper)
- Handlebars (by Boris Yankov)
- Highcharts (by damianog)
- History.js (by Boris Yankov)
- Humane.js (by John Vrbanac)
- Impress.js (by Boris Yankov)
- Jasmine (by Boris Yankov)
- jQuery (from TypeScript samples)
- jQuery Mobile (by Boris Yankov)
- jQuery UI (by Boris Yankov)
- jQuery.BBQ (by Adam R. Smith)
- jQuery.Cookie (by Roy Goode)
- jQuery.Globalize (by Boris Yankov)
- jQuery.Transit (by MrBigDog2U)
- jQuery.Validation (by Boris Yankov)
- Knockback (by Marcel Binot)
- Knockout.js (by Boris Yankov)
- Knockout.Mapping (by Boris Yankov)
- linq.js (by Marcin Najder)
- Modernizr (by Boris Yankov)
- Moment.js (by Michael Lakerveld)
- Mustache.js (by Boris Yankov)
- Node.js (from TypeScript samples)
- node_redis (by Boris Yankov)
- node-sqlserver (by Boris Yankov)
- PhoneGap (by Boris Yankov)
- PreloadJS (by Pedro Ferreira)
- QUnit (by Diullei Gomes)
- Raphael (by CheCoxshall)
- require.js (by Josh Baldwin)
- Sammy.js (by Boris Yankov)
- Select2 (by Boris Yankov)
- SignalR (by Boris Yankov)
- socket.io (by William Orr)
- SoundJS (by Pedro Ferreira)
- Spin (by Boris Yankov)
- Sugar (by Josh Baldwin)
- Teechart (by Steema)
- Toastr (by Boris Yankov)
- TweenJS (by Pedro Ferreira)
- tween.js (by Adam R. Smith)
- Ubuntu Unity Web API (by John Vrbanac)
- Underscore.js (by Boris Yankov)
- Underscore.js (Typed) (by Josh Baldwin)
Languages
TypeScript
100%