Skip to content

Commit 2fa76dd

Browse files
authored
TS changes (keybase#26395)
1 parent c5bc5b1 commit 2fa76dd

89 files changed

Lines changed: 2898 additions & 7710 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎protocol/bin/enabled-calls.json‎

Lines changed: 396 additions & 1126 deletions
Large diffs are not rendered by default.

‎protocol/bin/flow.js‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const enabledCalls = json5.parse(fs.readFileSync(path.join(__dirname, 'enabled-c
1111
// Sanity check this json file
1212
Object.keys(enabledCalls).forEach(rpc =>
1313
Object.keys(enabledCalls[rpc]).forEach(type => {
14-
if (!['promise', 'incoming', 'engineListener'].includes(type)) {
14+
if (!['promise', 'incoming', 'engineListener', 'custom'].includes(type)) {
1515
console.log(colors.red('ERROR! Invalid enabled call?\n\n '), rpc, type)
1616
process.exit(1)
1717
}
@@ -212,13 +212,11 @@ function analyzeMessages(json, project) {
212212
const isUIMethod = isUIProtocol || enabledCall(methodName, 'incoming')
213213

214214
if (isUIMethod) {
215-
project.incomingMaps[
216-
methodName
217-
] = `(params: MessageTypes[${methodName}]['inParam'] & {sessionID: number}) => void`
215+
project.incomingMaps[methodName] = `(params: MessageTypes[${methodName}]['inParam']) => void`
218216
if (!message.hasOwnProperty('notify')) {
219217
project.customResponseIncomingMaps[
220218
methodName
221-
] = `(params: MessageTypes[${methodName}]['inParam'] & {sessionID: number}, response: {error: IncomingErrorCallback, result: (res: MessageTypes[${methodName}]['outParam']) => void}) => void`
219+
] = `(params: MessageTypes[${methodName}]['inParam'], response: {error: IncomingErrorCallback, result: (res: MessageTypes[${methodName}]['outParam']) => void}) => void`
222220
}
223221
}
224222

@@ -400,7 +398,7 @@ function writeActions() {
400398
actions: Object.keys(projects).reduce((map, p) => {
401399
const callMap = projects[p].incomingMaps
402400
callMap &&
403-
Object.keys(callMap).reduce((map, method) => {
401+
Object.keys(callMap).reduce((m, method) => {
404402
const name = method
405403
.replace(/'/g, '')
406404
.split('.')
@@ -413,10 +411,10 @@ function writeActions() {
413411
response = `, response: {error: ${p}Types.IncomingErrorCallback, result: (param: ${p}Types.MessageTypes[${method}]['outParam']) => void}`
414412
}
415413

416-
map[name] = {
417-
params: `${p}Types.MessageTypes[${method}]['inParam'] & {sessionID: number}${response}`,
414+
m[name] = {
415+
params: `${p}Types.MessageTypes[${method}]['inParam'] ${response}`,
418416
}
419-
return map
417+
return m
420418
}, map)
421419
return map
422420
}, staticActions),
@@ -502,9 +500,10 @@ export type IncomingErrorCallback = (err?: SimpleError | null) => void
502500
const types = Object.keys(typeDefs.types).map(k => typeDefs.types[k])
503501
const messagePromise = Object.keys(typeDefs.messages).map(k => typeDefs.messages[k].rpcPromise)
504502
const messageEngineListener = Object.keys(typeDefs.messages).map(k => typeDefs.messages[k].engineListener)
505-
const callMapType = Object.keys(project.incomingMaps).length ? 'IncomingCallMapType' : 'void'
503+
// const callMapType = Object.keys(project.incomingMaps).length ? 'IncomingCallMapType' : 'void'
506504
const incomingMap = `\nexport type IncomingCallMapType = {
507505
${Object.keys(project.incomingMaps)
506+
.filter(im => enabledCall(im, 'incoming'))
508507
.map(im => ` ${im}?: ${project.incomingMaps[im]}`)
509508
.join(',')}
510509
}`
@@ -514,6 +513,7 @@ export type IncomingErrorCallback = (err?: SimpleError | null) => void
514513
: 'void'
515514
const customResponseIncomingMap = `\nexport type CustomResponseIncomingCallMap = {
516515
${Object.keys(project.customResponseIncomingMaps)
516+
.filter(im => enabledCall(im, 'custom'))
517517
.map(im => ` ${im}?: ${project.customResponseIncomingMaps[im]}`)
518518
.join(',')}
519519
}`
@@ -560,7 +560,7 @@ ${messageTypesData}
560560
function write(typeDefs, project) {
561561
// Need any for weird flow issue where it gets confused by multiple
562562
// incoming call map types
563-
const callMapType = Object.keys(project.incomingMaps).length ? 'IncomingCallMapType' : 'void'
563+
//const callMapType = Object.keys(project.incomingMaps).length ? 'IncomingCallMapType' : 'void'
564564

565565
const typePrelude = `/* eslint-disable */
566566

‎shared/actions/engine-gen-gen.tsx‎

Lines changed: 432 additions & 961 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎shared/actions/json/engine-gen.json‎

Lines changed: 216 additions & 216 deletions
Large diffs are not rendered by default.

‎shared/actions/remote-gen.tsx‎

Lines changed: 50 additions & 105 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎shared/chat/conversation/attachment-fullscreen/hooks.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const useData = (initialOrdinal: T.Chat.Ordinal) => {
88
const conversationIDKey = C.useChatContext(s => s.id)
99
const [ordinal, setOrdinal] = React.useState(initialOrdinal)
1010

11-
const message = C.useChatContext(s => {
11+
const message: T.Chat.MessageAttachment = C.useChatContext(s => {
1212
const m = s.messageMap.get(ordinal)
1313
return m?.type === 'attachment' ? m : blankMessage
1414
})

‎shared/chat/conversation/messages/shared-styles.tsx‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import * as Kb from '@/common-adapters'
22
// TODO remove
33
export const sharedStyles = Kb.Styles.styleSheetCreate(() => {
4-
const editing = {
4+
const editing: Kb.Styles._StylesCrossPlatform = {
55
borderRadius: 2,
66
color: Kb.Styles.globalColors.blackOrBlack,
77
paddingLeft: Kb.Styles.globalMargins.tiny,
88
paddingRight: Kb.Styles.globalMargins.tiny,
99
}
10-
const sent = Kb.Styles.platformStyles({
10+
const sent: Kb.Styles._StylesCrossPlatform = Kb.Styles.platformStyles({
1111
isElectron: {
1212
// Make text selectable. On mobile we implement that differently.
1313
cursor: 'text',
@@ -20,14 +20,12 @@ export const sharedStyles = Kb.Styles.styleSheetCreate(() => {
2020
...Kb.Styles.globalStyles.flexBoxColumn,
2121
},
2222
})
23-
const sentEditing = {
23+
const sentEditing: Kb.Styles._StylesCrossPlatform = {
2424
...sent,
2525
...editing,
2626
}
27-
const pendingFail = {
28-
...sent,
29-
}
30-
const pendingFailEditing = {
27+
const pendingFail = sent
28+
const pendingFailEditing: Kb.Styles._StylesCrossPlatform = {
3129
...pendingFail,
3230
...editing,
3331
}

‎shared/chat/conversation/messages/text/unfurl/unfurl-list/use-state.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export const getUnfurlInfo = (state: C.Chat.ConvoState, ordinal: T.Chat.Ordinal,
2020
const author = message?.author
2121
const you = C.useCurrentUserState.getState().username
2222
const youAreAuthor = author === you
23-
const unfurlInfo = [...(message?.unfurls?.values() ?? [])][idx]
23+
const unfurlInfo: undefined | T.RPCChat.UIMessageUnfurlInfo = [...(message?.unfurls?.values() ?? [])][idx]
2424

2525
if (!unfurlInfo)
2626
return {author: '', isCollapsed: false, unfurl: null, unfurlMessageID: 0, youAreAuthor: false}

‎shared/chat/emoji-picker/container.tsx‎

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
1-
import * as C from './../../constants'
1+
import * as C from '@/constants'
22
import * as React from 'react'
33
import * as Kb from '@/common-adapters'
4-
import * as T from './../../constants/types'
5-
import * as Data from './../../util/emoji'
6-
import type {LayoutEvent} from './../../common-adapters/box'
4+
import * as T from '@/constants/types'
5+
import * as Data from '@/util/emoji'
6+
import type {LayoutEvent} from '@/common-adapters/box'
77
import startCase from 'lodash/startCase'
88
import debounce from 'lodash/debounce'
99
import SkinTonePicker from './skin-tone-picker'
1010
import EmojiPicker, {getSkinToneModifierStrIfAvailable} from '.'
11-
import {
12-
emojiDataToRenderableEmoji,
13-
renderEmoji,
14-
type EmojiData,
15-
type RenderableEmoji,
16-
} from './../../util/emoji'
11+
import {emojiDataToRenderableEmoji, renderEmoji, type EmojiData, type RenderableEmoji} from '@/util/emoji'
1712
import {usePickerState, type PickKey} from './use-picker'
1813

1914
type Props = {

‎shared/chat/emoji-picker/use-picker.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ type Store = T.Immutable<{
1313
const initialStore: Store = {
1414
pickerMap: new Map(),
1515
}
16-
type State = Store & {
16+
interface State extends Store {
1717
dispatch: {
1818
resetState: 'default'
1919
updatePickerMap: (key: PickKey, val?: PickerValue) => void

0 commit comments

Comments
 (0)