Skip to content

Commit

Permalink
Update to typescript 3.6.3 (keybase#19190)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisnojima authored Sep 11, 2019
1 parent b660e9f commit 1168c9a
Show file tree
Hide file tree
Showing 46 changed files with 8,015 additions and 8,050 deletions.
2 changes: 1 addition & 1 deletion shared/actions/__tests__/signup.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import * as RouteTreeGen from '../route-tree-gen'
import {_testing} from '../signup'
import reducer from '../../reducers/signup'

const testLogger = new SagaLogger('TESTING', 'TESTINGFCN')
const testLogger = new SagaLogger('TESTING' as any, 'TESTINGFCN')

jest.unmock('immutable')

Expand Down
32 changes: 15 additions & 17 deletions shared/actions/chat2/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,18 +115,16 @@ function* inboxRefresh(
)
}

yield* Saga.callRPCs(
RPCChatTypes.localGetInboxNonblockLocalRpcSaga({
incomingCallMap: {'chat.1.chatUi.chatInboxUnverified': onUnverified},
params: {
identifyBehavior: RPCTypes.TLFIdentifyBehavior.chatGui,
maxUnbox: 0,
query: Constants.makeInboxQuery([]),
skipUnverified: false,
},
waitingKey: Constants.waitingKeyInboxRefresh,
})
)
yield RPCChatTypes.localGetInboxNonblockLocalRpcSaga({
incomingCallMap: {'chat.1.chatUi.chatInboxUnverified': onUnverified},
params: {
identifyBehavior: RPCTypes.TLFIdentifyBehavior.chatGui,
maxUnbox: 0,
query: Constants.makeInboxQuery([]),
skipUnverified: false,
},
waitingKey: Constants.waitingKeyInboxRefresh,
})
}

// When we get info on a team we need to unbox immediately so we can get the channel names
Expand Down Expand Up @@ -2152,7 +2150,7 @@ function* attachmentDownload(
}

// Download it
const destPath = yield* Saga.callPromise(downloadFilePath, message.fileName)
const destPath = yield downloadFilePath(message.fileName)
yield Saga.callUntyped(downloadAttachment, destPath, message)
}

Expand Down Expand Up @@ -2516,7 +2514,7 @@ function* mobileMessageAttachmentShare(
}
const fileName = yield* downloadAttachment('', message)
try {
yield* Saga.callPromise(showShareActionSheetFromFile, fileName, message.fileType)
yield showShareActionSheetFromFile(fileName)
} catch (e) {
logger.error('Failed to share attachment: ' + JSON.stringify(e))
}
Expand Down Expand Up @@ -2546,7 +2544,7 @@ function* mobileMessageAttachmentSave(
)
try {
logger.info('Trying to save chat attachment to camera roll')
yield* Saga.callPromise(saveAttachmentToCameraRoll, fileName, message.fileType)
yield saveAttachmentToCameraRoll(fileName, message.fileType)
} catch (err) {
logger.error('Failed to save attachment: ' + err)
throw new Error('Failed to save attachment: ' + err)
Expand Down Expand Up @@ -3394,15 +3392,15 @@ const createConversationFromTeamBuilder = (
}),
]

export function* chatTeamBuildingSaga(): Saga.SagaGenerator<any, any> {
export function* chatTeamBuildingSaga() {
yield* commonTeamBuildingSaga('chat2')
yield* Saga.chainAction2(
TeamBuildingGen.finishedTeamBuilding,
filterForNs('chat2', createConversationFromTeamBuilder)
)
}

function* chat2Saga(): Saga.SagaGenerator<any, any> {
function* chat2Saga() {
// Platform specific actions
if (isMobile) {
// Push us into the conversation
Expand Down
3 changes: 1 addition & 2 deletions shared/actions/config/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,6 @@ function* loadDaemonAccounts(
})
)
}
return undefined
}
}
}
Expand Down Expand Up @@ -589,7 +588,7 @@ const saveDarkPrefs = async (state: Container.TypedState) => {
} catch (_) {}
}

function* configSaga(): Saga.SagaGenerator<any, any> {
function* configSaga() {
// Start the handshake process. This means we tell all sagas we're handshaking with the daemon. If another
// saga needs to do something before we leave the loading screen they should call daemonHandshakeWait
yield* Saga.chainAction2([ConfigGen.restartHandshake, ConfigGen.startHandshake], startHandshake)
Expand Down
2 changes: 1 addition & 1 deletion shared/actions/deeplinks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ const handleAppLink = (state: Container.TypedState, action: DeeplinksGen.LinkPay
return false
}

function* deeplinksSaga(): Saga.SagaGenerator<any, any> {
function* deeplinksSaga() {
yield* Saga.chainAction2(DeeplinksGen.link, handleAppLink)
yield* Saga.chainAction2(DeeplinksGen.handleKeybaseLink, handleKeybaseLink)
}
Expand Down
30 changes: 14 additions & 16 deletions shared/actions/devices.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,20 @@ const load = async (state: Container.TypedState) => {
}
}

function* requestPaperKey(): Iterable<any> {
yield* Saga.callRPCs(
RPCTypes.loginPaperKeyRpcSaga({
customResponseIncomingCallMap: {
'keybase.1.loginUi.promptRevokePaperKeys': (_, response) => {
response.result(false)
},
function* requestPaperKey() {
yield RPCTypes.loginPaperKeyRpcSaga({
customResponseIncomingCallMap: {
'keybase.1.loginUi.promptRevokePaperKeys': (_, response) => {
response.result(false)
},
incomingCallMap: {
'keybase.1.loginUi.displayPaperKeyPhrase': ({phrase}) =>
Saga.put(DevicesGen.createPaperKeyCreated({paperKey: new HiddenString(phrase)})),
},
params: undefined,
waitingKey: Constants.waitingKey,
})
)
},
incomingCallMap: {
'keybase.1.loginUi.displayPaperKeyPhrase': ({phrase}) =>
Saga.put(DevicesGen.createPaperKeyCreated({paperKey: new HiddenString(phrase)})),
},
params: undefined,
waitingKey: Constants.waitingKey,
})
}

const requestEndangeredTLFsLoad = async (
Expand Down Expand Up @@ -128,7 +126,7 @@ const receivedBadgeState = (_: Container.TypedState, action: NotificationsGen.Re
],
})

function* deviceSaga(): Saga.SagaGenerator<any, any> {
function* deviceSaga() {
// Load devices
yield* Saga.chainAction2([DevicesGen.load, DevicesGen.revoked, DevicesGen.paperKeyCreated], load)
// Revoke device
Expand Down
2 changes: 1 addition & 1 deletion shared/actions/fs/common.native.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const downloadSuccess = async (state: TypedState, action: FsGen.DownloadSuccessP
}
}

export default function* nativeSaga(): Saga.SagaGenerator<any, any> {
export default function* nativeSaga() {
yield* Saga.chainAction2(FsGen.pickAndUpload, pickAndUploadToPromise)
yield* Saga.chainAction2(FsGen.downloadSuccess, downloadSuccess)
}
8 changes: 4 additions & 4 deletions shared/actions/fs/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ function* download(
case Types.DownloadIntent.None:
// This adds " (1)" suffix to the base name, if the destination path
// already exists.
localPath = yield* Saga.callPromise(Constants.downloadFilePathFromPath, path)
localPath = yield Constants.downloadFilePathFromPath(path)
break
case Types.DownloadIntent.CameraRoll:
case Types.DownloadIntent.Share:
Expand All @@ -411,7 +411,7 @@ function* download(
break
default:
Flow.ifFlowComplainsAboutThisFunctionYouHaventHandledAllCasesInASwitch(intent)
localPath = yield* Saga.callPromise(Constants.downloadFilePathFromPath, path)
localPath = yield Constants.downloadFilePathFromPath(path)
break
}

Expand Down Expand Up @@ -709,7 +709,7 @@ function* loadPathMetadata(_: TypedState, action: FsGen.LoadPathMetadataPayload)
let pathItem = makeEntry(dirent)
if (pathItem.type === Types.PathType.File) {
const mimeType = yield* _loadMimeType(path)
pathItem = pathItem.set('mimeType', mimeType)
pathItem = pathItem.set('mimeType', mimeType || null)
}
yield Saga.put(
FsGen.createPathItemLoaded({
Expand Down Expand Up @@ -1008,7 +1008,7 @@ const loadPathInfo = async (_: TypedState, action: FsGen.LoadPathInfoPayload) =>
})
}

function* fsSaga(): Saga.SagaGenerator<any, any> {
function* fsSaga() {
yield* Saga.chainAction2(FsGen.refreshLocalHTTPServerInfo, refreshLocalHTTPServerInfo)
yield* Saga.chainAction2(FsGen.cancelDownload, cancelDownload)
yield* Saga.chainGenerator<FsGen.DownloadPayload | FsGen.ShareNativePayload | FsGen.SaveMediaPayload>(
Expand Down
2 changes: 1 addition & 1 deletion shared/actions/fs/platform-specific.android.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const downloadSuccessAndroid = (state, action: FsGen.DownloadSuccessPayload) =>
return copyToDownloadDir(localPath, mimeType)
}

export default function* platformSpecificSaga(): Saga.SagaGenerator<any, any> {
export default function* platformSpecificSaga() {
yield Saga.spawn(nativeSaga)
yield* Saga.chainAction2(FsGen.downloadSuccess, downloadSuccessAndroid)
}
2 changes: 1 addition & 1 deletion shared/actions/fs/platform-specific.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as Saga from '../../util/saga'
import * as Types from '../../constants/types/fs'

declare function platformSpecificSaga(): Saga.SagaGenerator<any, any>
declare function platformSpecificSaga(): void

export default platformSpecificSaga
2 changes: 1 addition & 1 deletion shared/actions/fs/platform-specific.desktop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ const refreshMountDirs = async (
]
}

function* platformSpecificSaga(): Saga.SagaGenerator<any, any> {
function* platformSpecificSaga() {
yield* Saga.chainAction2(FsGen.openLocalPathInSystemFileManager, openLocalPathInSystemFileManager)
yield* Saga.chainAction2(FsGen.openPathInSystemFileManager, openPathInSystemFileManager)
if (!isLinux) {
Expand Down
2 changes: 1 addition & 1 deletion shared/actions/git.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ function* navigateToTeamRepo(state: TypedState, action: GitGen.NavigateToTeamRep
const receivedBadgeState = (_: TypedState, action: NotificationsGen.ReceivedBadgeStatePayload) =>
GitGen.createBadgeAppForGit({ids: new Set(action.payload.badgeState.newGitRepoGlobalUniqueIDs)})

function* gitSaga(): Saga.SagaGenerator<any, any> {
function* gitSaga() {
// Create / Delete
yield* Saga.chainAction2(GitGen.createPersonalRepo, createPersonalRepo)
yield* Saga.chainAction2(GitGen.createTeamRepo, createTeamRepo)
Expand Down
2 changes: 1 addition & 1 deletion shared/actions/gregor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const updateCategory = async (_: Container.TypedState, action: GregorGen.UpdateC
} catch (_) {}
}

function* gregorSaga(): Saga.SagaGenerator<any, any> {
function* gregorSaga() {
yield* Saga.chainAction2(GregorGen.updateCategory, updateCategory)
yield* Saga.chainAction2([GregorGen.checkReachability, ConfigGen.osNetworkStatusChanged], checkReachability)
yield* Saga.chainAction2(EngineGen.connected, registerForGregorNotifications)
Expand Down
58 changes: 28 additions & 30 deletions shared/actions/login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,35 +48,33 @@ const moveToProvisioning = (username: string) => (_: any, response: any) => {
// Actually do a user/pass login. Don't get sucked into a provisioning flow
function* login(_: Container.TypedState, action: LoginGen.LoginPayload) {
try {
yield* Saga.callRPCs(
RPCTypes.loginLoginRpcSaga({
customResponseIncomingCallMap: {
'keybase.1.gpgUi.selectKey': cancelOnCallback,
'keybase.1.loginUi.getEmailOrUsername': cancelOnCallback,
'keybase.1.provisionUi.DisplayAndPromptSecret': cancelOnCallback,
'keybase.1.provisionUi.PromptNewDeviceName': moveToProvisioning(action.payload.username),
'keybase.1.provisionUi.chooseDevice': cancelOnCallback,
'keybase.1.provisionUi.chooseGPGMethod': cancelOnCallback,
'keybase.1.secretUi.getPassphrase': getPasswordHandler(action.payload.password.stringValue()),
},
// cancel if we get any of these callbacks, we're logging in, not provisioning
incomingCallMap: {
'keybase.1.loginUi.displayPrimaryPaperKey': ignoreCallback,
'keybase.1.provisionUi.DisplaySecretExchanged': ignoreCallback,
'keybase.1.provisionUi.ProvisioneeSuccess': ignoreCallback,
'keybase.1.provisionUi.ProvisionerSuccess': ignoreCallback,
},
params: {
clientType: RPCTypes.ClientType.guiMain,
deviceName: '',
deviceType: isMobile ? 'mobile' : 'desktop',
doUserSwitch: flags.fastAccountSwitch,
paperKey: '',
username: action.payload.username,
},
waitingKey: Constants.waitingKey,
})
)
yield RPCTypes.loginLoginRpcSaga({
customResponseIncomingCallMap: {
'keybase.1.gpgUi.selectKey': cancelOnCallback,
'keybase.1.loginUi.getEmailOrUsername': cancelOnCallback,
'keybase.1.provisionUi.DisplayAndPromptSecret': cancelOnCallback,
'keybase.1.provisionUi.PromptNewDeviceName': moveToProvisioning(action.payload.username),
'keybase.1.provisionUi.chooseDevice': cancelOnCallback,
'keybase.1.provisionUi.chooseGPGMethod': cancelOnCallback,
'keybase.1.secretUi.getPassphrase': getPasswordHandler(action.payload.password.stringValue()),
},
// cancel if we get any of these callbacks, we're logging in, not provisioning
incomingCallMap: {
'keybase.1.loginUi.displayPrimaryPaperKey': ignoreCallback,
'keybase.1.provisionUi.DisplaySecretExchanged': ignoreCallback,
'keybase.1.provisionUi.ProvisioneeSuccess': ignoreCallback,
'keybase.1.provisionUi.ProvisionerSuccess': ignoreCallback,
},
params: {
clientType: RPCTypes.ClientType.guiMain,
deviceName: '',
deviceType: isMobile ? 'mobile' : 'desktop',
doUserSwitch: flags.fastAccountSwitch,
paperKey: '',
username: action.payload.username,
},
waitingKey: Constants.waitingKey,
})
logger.info('login call succeeded')
yield Saga.put(ConfigGen.createLoggedIn({causedBySignup: false, causedByStartup: false}))
} catch (e) {
Expand Down Expand Up @@ -107,7 +105,7 @@ const loadIsOnline = async () => {
}
}

function* loginSaga(): Saga.SagaGenerator<any, any> {
function* loginSaga() {
// Actually log in
yield* Saga.chainGenerator<LoginGen.LoginPayload>(LoginGen.login, login)
yield* Saga.chainAction2(LoginGen.launchForgotPasswordWebPage, launchForgotPasswordWebPage)
Expand Down
2 changes: 1 addition & 1 deletion shared/actions/notifications.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ const receivedBoxAuditError = (
),
})

function* notificationsSaga(): Saga.SagaGenerator<any, any> {
function* notificationsSaga() {
yield* Saga.chainAction2(NotificationsGen.receivedBadgeState, receivedBadgeState)
yield* Saga.chainAction2(EngineGen.keybase1NotifyAuditRootAuditError, receivedRootAuditError)
yield* Saga.chainAction2(EngineGen.keybase1NotifyAuditBoxAuditError, receivedBoxAuditError)
Expand Down
10 changes: 8 additions & 2 deletions shared/actions/people.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,13 @@ const getPeopleData = async (state: Container.TypedState, action: PeopleGen.GetP
.reduce(Constants.reduceRPCItemToPeopleItem, I.List())

if (debugTodo) {
const allTodos: Array<RPCTypes.HomeScreenTodoType> = Object.values(RPCTypes.HomeScreenTodoType)
const allTodos = Object.values(RPCTypes.HomeScreenTodoType).reduce<Array<RPCTypes.HomeScreenTodoType>>(
(arr, t) => {
typeof t !== 'string' && arr.push(t)
return arr
},
[]
)
allTodos.forEach(avdlType => {
const todoType = Constants.todoTypeEnumToType[avdlType]
if (newItems.some(t => t.type === 'todo' && t.todoType === todoType)) {
Expand Down Expand Up @@ -157,7 +163,7 @@ const connected = async () => {
}
}

const peopleSaga = function*(): Saga.SagaGenerator<any, any> {
const peopleSaga = function*() {
yield* Saga.chainAction2(PeopleGen.getPeopleData, getPeopleData)
yield* Saga.chainAction2(PeopleGen.markViewed, markViewed)
yield* Saga.chainAction2(PeopleGen.skipTodo, skipTodo)
Expand Down
2 changes: 1 addition & 1 deletion shared/actions/pinentry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const onCancel = (_: Container.TypedState, action: PinentryGen.OnCancelPayload)
})
}

function* pinentrySaga(): Saga.SagaGenerator<any, any> {
function* pinentrySaga() {
yield* Saga.chainAction2(PinentryGen.onSubmit, onSubmit)
yield* Saga.chainAction2(PinentryGen.onCancel, onCancel)
yield* Saga.chainAction2(PinentryGen.newPinentry, onNewPinentry)
Expand Down
4 changes: 2 additions & 2 deletions shared/actions/plan-billing.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// import logger from '../logger'
import * as Saga from '../util/saga'
// import * as Saga from '../util/saga'
// import * as Constants from '../constants/plan-billing'
// import * as Types from '../constants/types/plan-billing'
// import * as RPCTypes from '../constants/types/rpc-gen'
Expand Down Expand Up @@ -167,7 +167,7 @@ import * as Saga from '../util/saga'
// }
// }

function* billingSaga(): Saga.SagaGenerator<any, any> {
function* billingSaga() {
// this isn't used
// yield Saga.safeTakeEvery(Constants.updateBilling, updateBillingSaga)
// yield Saga.safeTakeEvery(Constants.fetchBillingAndQuota, fetchBillingAndQuotaSaga)
Expand Down
2 changes: 1 addition & 1 deletion shared/actions/platform-specific/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ export declare function getContentTypeFromURL(
}) => Promise<string> | void
)

export declare function platformConfigSaga(): Saga.SagaGenerator<any, any>
export declare function platformConfigSaga()
Loading

0 comments on commit 1168c9a

Please sign in to comment.