-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[#IP-84] Change strict configuration to true #109
base: master
Are you sure you want to change the base?
Changes from all commits
da61300
16471dc
da1d990
14e1dec
2704fcf
cb2283b
cb34d59
ad839f4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ type TableEntry = Readonly<{ | |
* @see https://docs.microsoft.com/en-us/rest/api/storageservices/query-timeout-and-pagination | ||
*/ | ||
export type PagedQuery = ( | ||
currentToken: TableService.TableContinuationToken | ||
currentToken: TableService.TableContinuationToken | undefined | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
currentToken?: TableService.TableContinuationToken Besides syntax, is this really optional? |
||
) => Promise<Either<Error, TableService.QueryEntitiesResult<TableEntry>>>; | ||
|
||
/** | ||
|
@@ -32,7 +32,7 @@ export const getPagedQuery = (tableService: TableService, table: string) => ( | |
tableService.queryEntities( | ||
table, | ||
tableQuery, | ||
currentToken, | ||
currentToken as TableService.TableContinuationToken, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is related to the comment above. If |
||
( | ||
error: Error, | ||
result: TableService.QueryEntitiesResult<TableEntry>, | ||
|
@@ -51,16 +51,16 @@ async function* iterateOnPages( | |
pagedQuery: PagedQuery | ||
): AsyncIterableIterator<ReadonlyArray<TableEntry>> { | ||
// tslint:disable-next-line: no-let | ||
let token: TableService.TableContinuationToken = null; | ||
let token: TableService.TableContinuationToken | undefined = undefined; | ||
do { | ||
// query for a page of entries | ||
const errorOrResults = await pagedQuery(token); | ||
const errorOrResults : Either<Error, TableService.QueryEntitiesResult<TableEntry>> = await pagedQuery(token); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When you manually specify the type of a variable is a subtle form of manual casting that we should avoid. The takeaway from this comment is: when you need to manually assign a type, it's a ringing bell that of poor typings somwhere else |
||
if (isLeft(errorOrResults)) { | ||
// throw an exception in case of error | ||
throw errorOrResults.value; | ||
} | ||
// call the async callback with the current page of entries | ||
const results = errorOrResults.value; | ||
const results : TableService.QueryEntitiesResult<TableEntry> = errorOrResults.value; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto |
||
yield results.entries; | ||
// update the continuation token, the loop will continue until | ||
// the token is defined | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,7 +108,7 @@ describe("GetUserServicesHandler", () => { | |
expect(result.kind).toBe("IResponseSuccessJson"); | ||
if (result.kind === "IResponseSuccessJson") { | ||
expect(result.value).toEqual({ | ||
items: aUserInfo.subscriptions.map(it => it.id) | ||
items: (aUserInfo.subscriptions as Subscription[]).map(it => it.id) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto: manual casting |
||
}); | ||
} | ||
}); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this?