Skip to content

Commit

Permalink
chore: upgrade to TypeScript 3.5
Browse files Browse the repository at this point in the history
  • Loading branch information
raymondfeng authored and bajtos committed May 30, 2019
1 parent bf07ff9 commit 1ccbeee
Show file tree
Hide file tree
Showing 35 changed files with 101 additions and 86 deletions.
6 changes: 3 additions & 3 deletions examples/express-composition/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/express-composition/package.json
Expand Up @@ -61,6 +61,6 @@
"@types/express": "^4.16.1",
"@types/node": "^10.11.2",
"tslint": "^5.16.0",
"typescript": "^3.4.5"
"typescript": "^3.5.1"
}
}
13 changes: 7 additions & 6 deletions examples/express-composition/src/controllers/note.controller.ts
Expand Up @@ -11,14 +11,14 @@ import {
Where,
} from '@loopback/repository';
import {
post,
param,
del,
get,
getFilterSchemaFor,
getWhereSchemaFor,
param,
patch,
post,
put,
del,
requestBody,
} from '@loopback/rest';
import {Note} from '../models';
Expand Down Expand Up @@ -51,7 +51,7 @@ export class NoteController {
},
})
async count(
@param.query.object('where', getWhereSchemaFor(Note)) where?: Where,
@param.query.object('where', getWhereSchemaFor(Note)) where?: Where<Note>,
): Promise<Count> {
return await this.noteRepository.count(where);
}
Expand All @@ -69,7 +69,8 @@ export class NoteController {
},
})
async find(
@param.query.object('filter', getFilterSchemaFor(Note)) filter?: Filter,
@param.query.object('filter', getFilterSchemaFor(Note))
filter?: Filter<Note>,
): Promise<Note[]> {
return await this.noteRepository.find(filter);
}
Expand All @@ -84,7 +85,7 @@ export class NoteController {
})
async updateAll(
@requestBody() note: Note,
@param.query.object('where', getWhereSchemaFor(Note)) where?: Where,
@param.query.object('where', getWhereSchemaFor(Note)) where?: Where<Note>,
): Promise<Count> {
return await this.noteRepository.updateAll(note, where);
}
Expand Down
6 changes: 3 additions & 3 deletions examples/greeter-extension/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/greeter-extension/package.json
Expand Up @@ -49,7 +49,7 @@
"@types/debug": "4.1.4",
"@types/node": "^10.11.2",
"tslint": "^5.16.0",
"typescript": "^3.4.5"
"typescript": "^3.5.1"
},
"dependencies": {
"@loopback/context": "^1.16.0",
Expand Down
6 changes: 3 additions & 3 deletions examples/hello-world/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/hello-world/package.json
Expand Up @@ -46,7 +46,7 @@
"@loopback/tslint-config": "^2.0.4",
"@types/node": "^10.11.2",
"tslint": "^5.16.0",
"typescript": "^3.4.5"
"typescript": "^3.5.1"
},
"keywords": [
"loopback",
Expand Down
6 changes: 3 additions & 3 deletions examples/lb3-application/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/lb3-application/package.json
Expand Up @@ -59,7 +59,7 @@
"@types/node": "^10.11.2",
"lodash": "^4.17.11",
"tslint": "^5.16.0",
"typescript": "^3.4.5"
"typescript": "^3.5.1"
},
"keywords": [
"loopback",
Expand Down
6 changes: 3 additions & 3 deletions examples/log-extension/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/log-extension/package.json
Expand Up @@ -48,7 +48,7 @@
"@types/debug": "^4.1.4",
"@types/node": "^10.11.2",
"tslint": "^5.16.0",
"typescript": "^3.4.5"
"typescript": "^3.5.1"
},
"dependencies": {
"@loopback/context": "^1.16.0",
Expand Down
6 changes: 3 additions & 3 deletions examples/rpc-server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/rpc-server/package.json
Expand Up @@ -50,6 +50,6 @@
"@types/express": "^4.11.1",
"@types/node": "^10.11.2",
"tslint": "^5.16.0",
"typescript": "^3.4.5"
"typescript": "^3.5.1"
}
}
6 changes: 3 additions & 3 deletions examples/soap-calculator/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/soap-calculator/package.json
Expand Up @@ -60,6 +60,6 @@
"mocha": "^6.1.3",
"source-map-support": "^0.5.5",
"tslint": "^5.16.0",
"typescript": "^3.4.5"
"typescript": "^3.5.1"
}
}
6 changes: 3 additions & 3 deletions examples/todo-list/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/todo-list/package.json
Expand Up @@ -56,7 +56,7 @@
"@types/node": "^10.11.2",
"lodash": "^4.17.10",
"tslint": "^5.16.0",
"typescript": "^3.4.5"
"typescript": "^3.5.1"
},
"keywords": [
"loopback",
Expand Down
Expand Up @@ -4,6 +4,7 @@
// License text available at https://opensource.org/licenses/MIT

import {
Count,
DefaultHasManyRepository,
HasManyRepository,
} from '@loopback/repository';
Expand Down Expand Up @@ -32,7 +33,8 @@ describe('TodoController', () => {
in our tests themselves.
=============================================================================
*/
let todos: sinon.SinonStub;
// tslint:disable:no-any
let todos: sinon.SinonStub<any[], Todo[]>;

/*
=============================================================================
Expand All @@ -42,10 +44,11 @@ describe('TodoController', () => {
in our tests themselves.
=============================================================================
*/
let create: sinon.SinonStub;
let find: sinon.SinonStub;
let patch: sinon.SinonStub;
let del: sinon.SinonStub;
let create: sinon.SinonStub<any[], Promise<Todo>>;
let find: sinon.SinonStub<any[], Promise<Todo[]>>;
let patch: sinon.SinonStub<any[], Promise<Count>>;
let del: sinon.SinonStub<any[], Promise<Count>>;
// tslint:enable:no-any

/*
=============================================================================
Expand Down Expand Up @@ -98,22 +101,22 @@ describe('TodoController', () => {

describe('patch()', () => {
it('returns a number of todos updated', async () => {
patch.resolves([aChangedTodo].length);
patch.resolves({count: [aChangedTodo].length});
const where = {title: aTodoWithId.title};
expect(
await controller.patch(aTodoListWithId.id!, aTodoToPatchTo, where),
).to.eql(1);
).to.eql({count: 1});
sinon.assert.calledWith(todos, aTodoListWithId.id!);
sinon.assert.calledWith(patch, aTodoToPatchTo, where);
});
});

describe('deleteAll()', () => {
it('successfully deletes existing items', async () => {
del.resolves(aListOfTodos.length);
expect(await controller.delete(aTodoListWithId.id!)).to.eql(
aListOfTodos.length,
);
it('returns a number of todos deleted', async () => {
del.resolves({count: aListOfTodos.length});
expect(await controller.delete(aTodoListWithId.id!)).to.eql({
count: aListOfTodos.length,
});
sinon.assert.calledWith(todos, aTodoListWithId.id!);
sinon.assert.called(del);
});
Expand Down Expand Up @@ -155,7 +158,8 @@ describe('TodoController', () => {
(todoListRepo as any).todos = todos;

// Setup CRUD fakes
({create, find, patch, delete: del} = constrainedTodoRepo.stubs);
// tslint:disable-next-line:no-any
({create, find, patch, delete: del} = constrainedTodoRepo.stubs as any);

controller = new TodoListTodoController(todoListRepo);
}
Expand Down
Expand Up @@ -56,7 +56,7 @@ export class TodoListTodoController {
})
async find(
@param.path.number('id') id: number,
@param.query.object('filter') filter?: Filter,
@param.query.object('filter') filter?: Filter<Todo>,
): Promise<Todo[]> {
return await this.todoListRepo.todos(id).find(filter);
}
Expand All @@ -72,7 +72,7 @@ export class TodoListTodoController {
async patch(
@param.path.number('id') id: number,
@requestBody() todo: Partial<Todo>,
@param.query.object('where', getWhereSchemaFor(Todo)) where?: Where,
@param.query.object('where', getWhereSchemaFor(Todo)) where?: Where<Todo>,
): Promise<Count> {
return await this.todoListRepo.todos(id).patch(todo, where);
}
Expand All @@ -87,7 +87,7 @@ export class TodoListTodoController {
})
async delete(
@param.path.number('id') id: number,
@param.query.object('where', getWhereSchemaFor(Todo)) where?: Where,
@param.query.object('where', getWhereSchemaFor(Todo)) where?: Where<Todo>,
): Promise<Count> {
return await this.todoListRepo.todos(id).delete(where);
}
Expand Down
9 changes: 6 additions & 3 deletions examples/todo-list/src/controllers/todo-list.controller.ts
Expand Up @@ -50,7 +50,8 @@ export class TodoListController {
},
})
async count(
@param.query.object('where', getWhereSchemaFor(TodoList)) where?: Where,
@param.query.object('where', getWhereSchemaFor(TodoList))
where?: Where<TodoList>,
): Promise<Count> {
return await this.todoListRepository.count(where);
}
Expand All @@ -64,7 +65,8 @@ export class TodoListController {
},
})
async find(
@param.query.object('filter', getFilterSchemaFor(TodoList)) filter?: Filter,
@param.query.object('filter', getFilterSchemaFor(TodoList))
filter?: Filter<TodoList>,
): Promise<TodoList[]> {
return await this.todoListRepository.find(filter);
}
Expand All @@ -79,7 +81,8 @@ export class TodoListController {
})
async updateAll(
@requestBody() obj: Partial<TodoList>,
@param.query.object('where', getWhereSchemaFor(TodoList)) where?: Where,
@param.query.object('where', getWhereSchemaFor(TodoList))
where?: Where<TodoList>,
): Promise<Count> {
return await this.todoListRepository.updateAll(obj, where);
}
Expand Down
3 changes: 2 additions & 1 deletion examples/todo-list/src/controllers/todo.controller.ts
Expand Up @@ -60,7 +60,8 @@ export class TodoController {
},
})
async findTodos(
@param.query.object('filter', getFilterSchemaFor(Todo)) filter?: Filter,
@param.query.object('filter', getFilterSchemaFor(Todo))
filter?: Filter<Todo>,
): Promise<Todo[]> {
return await this.todoRepo.find(filter);
}
Expand Down
6 changes: 3 additions & 3 deletions examples/todo/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/todo/package.json
Expand Up @@ -56,7 +56,7 @@
"@types/node": "^10.11.2",
"lodash": "^4.17.10",
"tslint": "^5.16.0",
"typescript": "^3.4.5"
"typescript": "^3.5.1"
},
"keywords": [
"loopback",
Expand Down
Expand Up @@ -100,7 +100,7 @@ describe('TodoController', () => {

it('uses the provided filter', async () => {
const find = todoRepo.stubs.find;
const filter: Filter = {where: {isCompleted: false}};
const filter: Filter<Todo> = {where: {isComplete: false}};

find.resolves(aListOfTodos);
await controller.findTodos(filter);
Expand Down

0 comments on commit 1ccbeee

Please sign in to comment.