mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 14:57:10 +00:00
Remove 'promises-a-plus' and lint stamplay (#15176)
This commit is contained in:
Vendored
-18
@@ -1,18 +0,0 @@
|
||||
// Type definitions for promises-a-plus
|
||||
// Project: http://promisesaplus.com/
|
||||
// Definitions by: Igor Oleinikov <https://github.com/Igorbek>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace PromisesAPlus {
|
||||
interface PromiseCtor {
|
||||
<T>(resolver: (resolvePromise: (value: T) => void, rejectPromise: (reason: any) => void) => void): Thenable<T>;
|
||||
}
|
||||
|
||||
interface PromiseImpl {
|
||||
new <T>(resolver: (resolvePromise: (value: T) => void, rejectPromise: (reason: any) => void) => void): Thenable<T>;
|
||||
}
|
||||
|
||||
interface Thenable<T> {
|
||||
then<R>(onFulfill?: (value: T) => Thenable<R>|R, onReject?: (error: any) => Thenable<R>|R): Thenable<R>;
|
||||
}
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
/// <reference types="rx"/>
|
||||
/// <reference types="q"/>
|
||||
/// <reference types="when"/>
|
||||
|
||||
var thenNum: PromisesAPlus.Thenable<number>;
|
||||
var thenStr: PromisesAPlus.Thenable<string>;
|
||||
var thenBool: PromisesAPlus.Thenable<boolean>;
|
||||
|
||||
var impl: PromisesAPlus.PromiseImpl;
|
||||
|
||||
declare class PromiseImpl<R> {
|
||||
constructor(resolver: (resolvePromise: (value: R) => void, rejectPromise: (reason: any) => void) => void);
|
||||
|
||||
then<U>(onFulfill: (value: R) => PromiseImpl<U>, onReject: (error: any) => PromiseImpl<U>): PromiseImpl<U>;
|
||||
then<U>(onFulfill: (value: R) => PromiseImpl<U>, onReject?: (error: any) => U): PromiseImpl<U>;
|
||||
then<U>(onFulfill: (value: R) => U, onReject: (error: any) => PromiseImpl<U>): PromiseImpl<U>;
|
||||
then<U>(onFulfill?: (value: R) => U, onReject?: (error: any) => U): PromiseImpl<U>;
|
||||
}
|
||||
|
||||
function testCompatibleWithPromiseImpl() {
|
||||
var pNum: PromiseImpl<number> = thenNum;
|
||||
|
||||
thenNum = pNum;
|
||||
|
||||
impl = PromiseImpl;
|
||||
}
|
||||
|
||||
function testCompatibleWithRxJS() {
|
||||
// from spec to Rx
|
||||
var rxThenNum: Rx.IPromise<number> = thenNum;
|
||||
var rxThenStr: Rx.IPromise<string> = thenStr;
|
||||
|
||||
// from Rx to spec
|
||||
thenNum = rxThenNum;
|
||||
thenStr = rxThenStr;
|
||||
|
||||
var obsNum: Rx.Observable<number>;
|
||||
|
||||
// implementation usage
|
||||
thenNum = obsNum.toPromise<PromisesAPlus.Thenable<number>>(impl);
|
||||
thenNum = obsNum.toPromise(impl);
|
||||
obsNum.toPromise(PromiseImpl);
|
||||
}
|
||||
|
||||
function testCompatibleWithES6Promises() {
|
||||
// define ES6 thenables
|
||||
var es6ThenNum: PromiseLike<number>;
|
||||
var es6ThenStr: PromiseLike<string>;
|
||||
|
||||
// from ES6 to spec
|
||||
thenNum = es6ThenNum;
|
||||
thenStr = es6ThenStr;
|
||||
|
||||
// implementation
|
||||
impl = Promise;
|
||||
}
|
||||
|
||||
function testCompatibleWithQ() {
|
||||
// from spec to ES6
|
||||
var qThenNum: Q.IPromise<number> = thenNum;
|
||||
var qThenStr: Q.IPromise<string> = thenStr;
|
||||
|
||||
// from ES6 to spec
|
||||
thenNum = qThenNum;
|
||||
thenStr = qThenStr;
|
||||
|
||||
// there's no standart implementation with constructor behaviour
|
||||
}
|
||||
|
||||
function testCompatibleWithWhen() {
|
||||
var whenPromiseNum: When.Promise<number>;
|
||||
var whenPromiseStr: When.Promise<string>;
|
||||
|
||||
// from ES6 to spec
|
||||
thenNum = whenPromiseNum;
|
||||
thenStr = whenPromiseStr;
|
||||
|
||||
// there's no standart implementation with constructor behaviour
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"promises-a-plus-tests.ts"
|
||||
]
|
||||
}
|
||||
Vendored
+17
-25
@@ -1,35 +1,27 @@
|
||||
// Type definitions for stamplay-js-sdk 1.2.9
|
||||
// Type definitions for stamplay-js-sdk 1.2
|
||||
// Project: https://github.com/Stamplay/stamplay-js-sdk
|
||||
// Definitions by: Riderman de Sousa Barbosa <https://github.com/ridermansb/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="promises-a-plus" />
|
||||
|
||||
declare namespace Stamplay {
|
||||
export function init(appId: string): void;
|
||||
export function User(): StamplayObject;
|
||||
export function Cobject(object: string): StamplayObject;
|
||||
|
||||
export interface IStamplayModel {
|
||||
signup({}) : PromisesAPlus.Thenable<any>
|
||||
new() : IStamplayModel
|
||||
get(property : string) : any
|
||||
set(property : string, value: any) : void
|
||||
unset(property : string) : void
|
||||
fetch(id : any) : PromisesAPlus.Thenable<any>
|
||||
destroy() : PromisesAPlus.Thenable<any>
|
||||
save({}?) : PromisesAPlus.Thenable<any>
|
||||
upVote() : PromisesAPlus.Thenable<any>
|
||||
export interface Model {
|
||||
signup({}): Promise<any>;
|
||||
new(): Model; // This is suspicious, but tests show model instances being constructable...
|
||||
get(property: string): any;
|
||||
set(property: string, value: any): void;
|
||||
unset(property: string) : void;
|
||||
fetch(id: any) : Promise<any>;
|
||||
destroy(): Promise<any>;
|
||||
save({}?): Promise<any>;
|
||||
upVote(): Promise<any>;
|
||||
}
|
||||
|
||||
export interface IStamplayObject {
|
||||
Model : IStamplayModel
|
||||
Collection : any
|
||||
|
||||
}
|
||||
|
||||
export interface StamplayStatic {
|
||||
init(appId : string) : void;
|
||||
User() : IStamplayObject
|
||||
Cobject(object : string) : IStamplayObject
|
||||
export interface StamplayObject {
|
||||
Model: Model;
|
||||
Collection : any;
|
||||
}
|
||||
}
|
||||
|
||||
declare var Stamplay: Stamplay.StamplayStatic;
|
||||
|
||||
@@ -11,26 +11,24 @@ var registrationData = {
|
||||
password: 'mySecret'
|
||||
};
|
||||
|
||||
user.signup(registrationData).then(function(){
|
||||
user.set('phoneNumber', '020 123 4567' );
|
||||
return user.save();
|
||||
}).then(function(){
|
||||
var number = user.get('phoneNumber');
|
||||
console.log(number); // number value is 020 123 4567
|
||||
});
|
||||
user.signup(registrationData).then(() => {
|
||||
user.set('phoneNumber', '020 123 4567' );
|
||||
return user.save();
|
||||
}).then(() => {
|
||||
var number = user.get('phoneNumber');
|
||||
console.log(number); // number value is 020 123 4567
|
||||
});
|
||||
|
||||
|
||||
// Action
|
||||
var colFoo = Stamplay.Cobject('foo');
|
||||
var fooMod = new colFoo.Model();
|
||||
fooMod.fetch(5).then(
|
||||
function(){
|
||||
return fooMod.upVote()
|
||||
}
|
||||
).then(
|
||||
function(){
|
||||
fooMod.fetch(5)
|
||||
.then(() => fooMod.upVote())
|
||||
.then(
|
||||
() => {
|
||||
//success callback
|
||||
}, function( err : any ){
|
||||
}, (err: any) => {
|
||||
//error callback
|
||||
}
|
||||
)
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
Reference in New Issue
Block a user