mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-06 22:35:57 +08:00
Fixed linter issues
This commit is contained in:
18
types/parse/index.d.ts
vendored
18
types/parse/index.d.ts
vendored
@@ -13,11 +13,11 @@
|
||||
|
||||
declare namespace Parse {
|
||||
|
||||
var applicationId: string;
|
||||
var javaScriptKey: string | undefined;
|
||||
var masterKey: string | undefined;
|
||||
var serverURL: string;
|
||||
var VERSION: string;
|
||||
let applicationId: string;
|
||||
let javaScriptKey: string | undefined;
|
||||
let masterKey: string | undefined;
|
||||
let serverURL: string;
|
||||
let VERSION: string;
|
||||
|
||||
interface SuccessOption {
|
||||
success?: Function;
|
||||
@@ -97,11 +97,11 @@ declare namespace Parse {
|
||||
reject(error: any): void;
|
||||
resolve(result: any): void;
|
||||
then<U>(resolvedCallback: (...values: T[]) => IPromise<U>,
|
||||
rejectedCallback?: (reason: any) => IPromise<U>): IPromise<U>;
|
||||
rejectedCallback?: (reason: any) => IPromise<U>): IPromise<U>;
|
||||
then<U>(resolvedCallback: (...values: T[]) => U,
|
||||
rejectedCallback?: (reason: any) => IPromise<U>): IPromise<U>;
|
||||
rejectedCallback?: (reason: any) => IPromise<U>): IPromise<U>;
|
||||
then<U>(resolvedCallback: (...values: T[]) => U,
|
||||
rejectedCallback?: (reason: any) => U): IPromise<U>;
|
||||
rejectedCallback?: (reason: any) => U): IPromise<U>;
|
||||
}
|
||||
|
||||
interface Pointer {
|
||||
@@ -933,7 +933,7 @@ declare namespace Parse {
|
||||
*
|
||||
* import Buffer = require("buffer").Buffer;
|
||||
*/
|
||||
var HTTPOptions: new () => HTTPOptions;
|
||||
let HTTPOptions: new () => HTTPOptions;
|
||||
interface HTTPOptions {
|
||||
/**
|
||||
* The body of the request.
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
|
||||
function test_events() {
|
||||
|
||||
var object = new Parse.Events();
|
||||
const object = new Parse.Events();
|
||||
object.on("alert", (eventName: string) => alert("Triggered " + eventName));
|
||||
|
||||
object.trigger("alert", "an event");
|
||||
|
||||
var onChange = () => console.log('whatever');
|
||||
var context: any;
|
||||
const onChange = () => console.log('whatever');
|
||||
let context: any;
|
||||
|
||||
object.off("change", onChange);
|
||||
object.off("change");
|
||||
@@ -29,29 +29,29 @@ class Game extends Parse.Object {
|
||||
|
||||
constructor(options?: any) {
|
||||
|
||||
super("GameScore", options);
|
||||
super("Game", options);
|
||||
}
|
||||
}
|
||||
|
||||
function test_object() {
|
||||
|
||||
var game = new Game();
|
||||
const game = new Game();
|
||||
|
||||
game.fetch({
|
||||
success(g: Game) { }
|
||||
});
|
||||
|
||||
// Create a new instance of that class.
|
||||
var gameScore = new GameScore();
|
||||
const gameScore = new GameScore();
|
||||
|
||||
gameScore.set("score", 1337);
|
||||
gameScore.set("playerName", "Sean Plott");
|
||||
gameScore.set("cheatMode", false);
|
||||
|
||||
|
||||
var score = gameScore.get("score");
|
||||
var playerName = gameScore.get("playerName");
|
||||
var cheatMode = gameScore.get("cheatMode");
|
||||
const score = gameScore.get("score");
|
||||
const playerName = gameScore.get("playerName");
|
||||
const cheatMode = gameScore.get("cheatMode");
|
||||
|
||||
gameScore.increment("score");
|
||||
gameScore.addUnique("skills", "flying");
|
||||
@@ -59,14 +59,14 @@ function test_object() {
|
||||
|
||||
game.set("gameScore", gameScore);
|
||||
|
||||
var gameCopy = Game.fromJSON(JSON.parse(JSON.stringify(game)), true);
|
||||
const gameCopy = Game.fromJSON(JSON.parse(JSON.stringify(game)), true);
|
||||
}
|
||||
|
||||
function test_query() {
|
||||
|
||||
var gameScore = new GameScore();
|
||||
const gameScore = new GameScore();
|
||||
|
||||
var query = new Parse.Query(GameScore);
|
||||
const query = new Parse.Query(GameScore);
|
||||
query.equalTo("playerName", "Dan Stemkoski");
|
||||
query.notEqualTo("playerName", "Michael Yabuti");
|
||||
query.greaterThan("playerAge", 18);
|
||||
@@ -120,7 +120,7 @@ function test_query() {
|
||||
query.include("score");
|
||||
query.include(["score.team"]);
|
||||
|
||||
var testQuery = Parse.Query.or(query, query);
|
||||
const testQuery = Parse.Query.or(query, query);
|
||||
}
|
||||
|
||||
class TestCollection extends Parse.Collection<Object> {
|
||||
@@ -141,9 +141,9 @@ function return_a_query(): Parse.Query {
|
||||
|
||||
function test_collections() {
|
||||
|
||||
var collection = new TestCollection();
|
||||
let collection = new TestCollection();
|
||||
|
||||
var query = new Parse.Query(Game);
|
||||
const query = new Parse.Query(Game);
|
||||
query.equalTo("temperature", "hot");
|
||||
query.greaterThan("degreesF", 100);
|
||||
|
||||
@@ -167,10 +167,10 @@ function test_collections() {
|
||||
}
|
||||
);
|
||||
|
||||
var model = collection.at(0);
|
||||
const model = collection.at(0);
|
||||
|
||||
// Or you can get it by Parse objectId.
|
||||
var modelAgain = collection.get(model.id);
|
||||
const modelAgain = collection.get(model.id);
|
||||
|
||||
// Remove "Duke" from the collection.
|
||||
collection.remove(model);
|
||||
@@ -184,15 +184,15 @@ function test_collections() {
|
||||
|
||||
function test_file() {
|
||||
|
||||
var base64 = "V29ya2luZyBhdCBQYXJzZSBpcyBncmVhdCE=";
|
||||
var file = new Parse.File("myfile.txt", { base64: base64 });
|
||||
const base64 = "V29ya2luZyBhdCBQYXJzZSBpcyBncmVhdCE=";
|
||||
let file = new Parse.File("myfile.txt", { base64: base64 });
|
||||
|
||||
var bytes = [0xBE, 0xEF, 0xCA, 0xFE];
|
||||
var file = new Parse.File("myfile.txt", bytes);
|
||||
const bytes = [0xBE, 0xEF, 0xCA, 0xFE];
|
||||
file = new Parse.File("myfile.txt", bytes);
|
||||
|
||||
var file = new Parse.File("myfile.zzz", {}, "image/png");
|
||||
file = new Parse.File("myfile.zzz", {}, "image/png");
|
||||
|
||||
var src = file.url();
|
||||
const src = file.url();
|
||||
|
||||
file.save().then(
|
||||
() => {
|
||||
@@ -211,7 +211,7 @@ function test_file() {
|
||||
|
||||
function test_analytics() {
|
||||
|
||||
var dimensions = {
|
||||
const dimensions = {
|
||||
// Define ranges to bucket data points into meaningful segments
|
||||
priceRange: '1000-1500',
|
||||
// Did the user filter the query?
|
||||
@@ -222,7 +222,7 @@ function test_analytics() {
|
||||
// Send the dimensions to Parse along with the 'search' event
|
||||
Parse.Analytics.track('search', dimensions);
|
||||
|
||||
var codeString = '404';
|
||||
const codeString = '404';
|
||||
Parse.Analytics.track('error', { code: codeString })
|
||||
}
|
||||
|
||||
@@ -232,7 +232,7 @@ function test_relation() {
|
||||
|
||||
function test_user_acl_roles() {
|
||||
|
||||
var user = new Parse.User();
|
||||
const user = new Parse.User();
|
||||
user.set("username", "my name");
|
||||
user.set("password", "my pass");
|
||||
user.set("email", "email@example.com");
|
||||
@@ -240,7 +240,7 @@ function test_user_acl_roles() {
|
||||
// other fields can be set just like with Parse.Object
|
||||
user.set("phone", "415-392-0202");
|
||||
|
||||
var currentUser = Parse.User.current();
|
||||
const currentUser = Parse.User.current();
|
||||
if (currentUser) {
|
||||
// do stuff with the user
|
||||
} else {
|
||||
@@ -253,17 +253,17 @@ function test_user_acl_roles() {
|
||||
// The token could not be validated.
|
||||
});
|
||||
|
||||
var game = new Game();
|
||||
const game = new Game();
|
||||
game.set("score", new GameScore());
|
||||
game.setACL(new Parse.ACL(Parse.User.current()));
|
||||
game.save().then((game: Game) => { });
|
||||
game.save(null, { useMasterKey: true });
|
||||
|
||||
var groupACL = new Parse.ACL();
|
||||
const groupACL = new Parse.ACL();
|
||||
|
||||
var userList: Parse.User[] = [Parse.User.current()!];
|
||||
const userList: Parse.User[] = [Parse.User.current()!];
|
||||
// userList is an array with the users we are sending this message to.
|
||||
for (var i = 0; i < userList.length; i++) {
|
||||
for (let i = 0; i < userList.length; i++) {
|
||||
groupACL.setReadAccess(userList[i], true);
|
||||
groupACL.setWriteAccess(userList[i], true);
|
||||
}
|
||||
@@ -279,7 +279,7 @@ function test_user_acl_roles() {
|
||||
});
|
||||
|
||||
// By specifying no write privileges for the ACL, we can ensure the role cannot be altered.
|
||||
var role = new Parse.Role("Administrator", groupACL);
|
||||
const role = new Parse.Role("Administrator", groupACL);
|
||||
role.getUsers().add(userList[0]);
|
||||
role.getRoles().add(role);
|
||||
role.save();
|
||||
@@ -311,7 +311,7 @@ function test_facebook_util() {
|
||||
}
|
||||
});
|
||||
|
||||
var user = Parse.User.current()!;
|
||||
const user = Parse.User.current()!;
|
||||
|
||||
if (!Parse.FacebookUtils.isLinked(user)) {
|
||||
Parse.FacebookUtils.link(user, null, {
|
||||
@@ -350,7 +350,7 @@ function test_cloud_functions() {
|
||||
});
|
||||
|
||||
Parse.Cloud.beforeDelete('MyCustomClass', (request: Parse.Cloud.BeforeDeleteRequest,
|
||||
response: Parse.Cloud.BeforeDeleteResponse) => {
|
||||
response: Parse.Cloud.BeforeDeleteResponse) => {
|
||||
// result
|
||||
});
|
||||
|
||||
@@ -366,27 +366,27 @@ class PlaceObject extends Parse.Object { }
|
||||
|
||||
function test_geo_points() {
|
||||
|
||||
var point = new Parse.GeoPoint({ latitude: 40.0, longitude: -30.0 });
|
||||
const point = new Parse.GeoPoint({ latitude: 40.0, longitude: -30.0 });
|
||||
|
||||
var userObject = Parse.User.current()!;
|
||||
const userObject = Parse.User.current()!;
|
||||
|
||||
// User's location
|
||||
var userGeoPoint = userObject.get("location");
|
||||
const userGeoPoint = userObject.get("location");
|
||||
|
||||
// Create a query for places
|
||||
var query = new Parse.Query(Parse.User);
|
||||
const query = new Parse.Query(Parse.User);
|
||||
// Interested in locations near user.
|
||||
query.near("location", userGeoPoint);
|
||||
// Limit what could be a lot of points.
|
||||
query.limit(10);
|
||||
|
||||
var southwestOfSF = new Parse.GeoPoint(37.708813, -122.526398);
|
||||
var northeastOfSF = new Parse.GeoPoint(37.822802, -122.373962);
|
||||
const southwestOfSF = new Parse.GeoPoint(37.708813, -122.526398);
|
||||
const northeastOfSF = new Parse.GeoPoint(37.822802, -122.373962);
|
||||
|
||||
var query2 = new Parse.Query(PlaceObject);
|
||||
const query2 = new Parse.Query(PlaceObject);
|
||||
query2.withinGeoBox("location", southwestOfSF, northeastOfSF);
|
||||
|
||||
var query3 = new Parse.Query("PlaceObject").find().then((o: Parse.Object[]) => { });
|
||||
const query3 = new Parse.Query("PlaceObject").find().then((o: Parse.Object[]) => { });
|
||||
}
|
||||
|
||||
function test_push() {
|
||||
@@ -405,7 +405,7 @@ function test_push() {
|
||||
}
|
||||
});
|
||||
|
||||
var query = new Parse.Query(Parse.Installation);
|
||||
const query = new Parse.Query(Parse.Installation);
|
||||
query.equalTo('injuryReports', true);
|
||||
|
||||
Parse.Push.send({
|
||||
@@ -425,8 +425,8 @@ function test_push() {
|
||||
|
||||
function test_view() {
|
||||
|
||||
var model = Parse.User.current();
|
||||
var view = new Parse.View<Parse.User>();
|
||||
const model = Parse.User.current();
|
||||
const view = new Parse.View<Parse.User>();
|
||||
}
|
||||
|
||||
function test_promise() {
|
||||
|
||||
Reference in New Issue
Block a user