Skip to content

Commit

Permalink
fix: support typescript 2.4
Browse files Browse the repository at this point in the history
This fixes one actual runtime bug and improves the type annotations to fix type check errors caught
by Typescript 2.4.
  • Loading branch information
jbms committed Aug 3, 2017
1 parent d10d3e2 commit 1b4be96
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 17 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -77,7 +77,7 @@
"sortablejs": "^1.5.0-rc1",
"style-loader": "^0.13.0",
"ts-loader": "1.3.2",
"typescript": "2.3",
"typescript": "2.4",
"webpack": "^2.2.0",
"webpack-closure-compiler": "^2.1.2"
}
Expand Down
2 changes: 1 addition & 1 deletion src/neuroglancer/chunk_manager/backend.ts
Expand Up @@ -259,7 +259,7 @@ class ChunkPriorityQueue {
private recentHead = new Chunk();
constructor(
private heapOperations: PairingHeapOperations<Chunk>,
private linkedListOperations: LinkedListOperations) {
private linkedListOperations: LinkedListOperations<Chunk>) {
linkedListOperations.initializeHead(this.recentHead);
}

Expand Down
11 changes: 6 additions & 5 deletions src/neuroglancer/datasource/brainmaps/frontend.ts
Expand Up @@ -370,11 +370,12 @@ export function getChangeStackList(
chunkManager: ChunkManager, instance: BrainmapsInstance, volumeId: string) {
return chunkManager.memoize.getUncounted(
{instance, type: 'brainmaps:getChangeStackList', volumeId}, () => {
let promise: Promise<string[]> = makeRequest(instance, {
method: 'GET',
path: `/v1beta2/changes/${volumeId}/change_stacks`,
responseType: 'json'
}).then(response => parseChangeStackList(response));
let promise: Promise<string[]|undefined> =
makeRequest(instance, {
method: 'GET',
path: `/v1beta2/changes/${volumeId}/change_stacks`,
responseType: 'json'
}).then(response => parseChangeStackList(response));
const description = `change stacks for ${volumeId}`;
StatusMessage.forPromise(promise, {
delay: true,
Expand Down
2 changes: 1 addition & 1 deletion src/neuroglancer/layer_dialog.ts
Expand Up @@ -217,7 +217,7 @@ export class LayerDialog extends Overlay {

this.setInfo('Validating volume source...');
const token = this.volumeCancellationSource = new CancellationTokenSource();
getVolume(this.manager.chunkManager, url, token)
getVolume(this.manager.chunkManager, url, /*options=*/undefined, token)
.then(source => {
if (token.isCanceled) {
return;
Expand Down
18 changes: 9 additions & 9 deletions src/neuroglancer/util/linked_list.ts
Expand Up @@ -14,13 +14,13 @@
* limitations under the License.
*/

export interface LinkedListOperations {
insertAfter: <T>(head: T, x: T) => void;
pop: <T>(head: T) => T;
insertBefore: <T>(head: T, x: T) => void;
front: <T>(head: T) => T | null;
back: <T>(head: T) => T | null;
iterator: <T>(head: T) => Iterator<T>;
reverseIterator: <T>(head: T) => Iterator<T>;
initializeHead: <T>(head: T) => void;
export interface LinkedListOperations<T> {
insertAfter: (head: T, x: T) => void;
pop: (head: T) => T;
insertBefore: (head: T, x: T) => void;
front: (head: T) => T | null;
back: (head: T) => T | null;
iterator: (head: T) => Iterator<T>;
reverseIterator: (head: T) => Iterator<T>;
initializeHead: (head: T) => void;
}

0 comments on commit 1b4be96

Please sign in to comment.