fix name, class to interface, var to const, enable strictNullChecks

This commit is contained in:
york yao
2017-01-26 19:20:44 +08:00
parent 59244e309e
commit e297d2677f
3 changed files with 11 additions and 11 deletions

View File

@@ -1,4 +1,4 @@
// Type definitions for Jasmine 2.5
// Type definitions for node-zookeeper-client 0.2
// Project: https://github.com/alexguan/node-zookeeper-client
// Definitions by: York Yao <https://github.com/plantain-00/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -72,7 +72,7 @@ export class Event {
getPath(): string;
}
export class Transaction {
interface Transaction {
create(path: string, dataOrAclsOrmode1?: Buffer | ACL[] | number, dataOrAclsOrmode2?: Buffer | ACL[] | number, dataOrAclsOrmode3?: Buffer | ACL[] | number): this;
setData(path: string, data: Buffer | null, version?: number): this;
check(path: string, version?: number): this;
@@ -80,7 +80,7 @@ export class Transaction {
commit(callback: (error: Error | Exception, results: any) => void): void;
}
export class Client extends EventEmitter {
interface Client extends EventEmitter {
connect(): void;
close(): void;
create(path: string, callback: (error: Error | Exception, path: string) => void): void;

View File

@@ -1,8 +1,8 @@
import * as zookeeper from "node-zookeeper-client";
{
var client = zookeeper.createClient('localhost:2181');
var path = process.argv[2];
const client = zookeeper.createClient('localhost:2181');
const path = process.argv[2];
client.once('connected', function () {
console.log('Connected to the server.');
@@ -44,8 +44,8 @@ function listChildren(client: zookeeper.Client, path: string) {
}
{
var client = zookeeper.createClient('localhost:2181');
var path = process.argv[2];
const client = zookeeper.createClient('localhost:2181');
const path = process.argv[2];
client.once('connected', function () {
console.log('Connected to ZooKeeper.');
@@ -55,7 +55,7 @@ function listChildren(client: zookeeper.Client, path: string) {
client.connect();
}
var client = zookeeper.createClient(
const client = zookeeper.createClient(
'localhost:2181/test',
{ sessionTimeout: 10000 }
);
@@ -188,12 +188,12 @@ var client = zookeeper.createClient(
}
{
var state = client.getState();
const state = client.getState();
console.log('Current state is: %s', state);
}
{
var id = client.getSessionId();
const id = client.getSessionId();
console.log('Session id is: %s', id.toString('hex'));
}

View File

@@ -6,7 +6,7 @@
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"