Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
war-in committed May 20, 2024
1 parent e8ae3c5 commit 0f9ab4a
Show file tree
Hide file tree
Showing 15 changed files with 22 additions and 18 deletions.
1 change: 0 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ module.exports = {
__DEV__: 'readonly',
},
rules: {
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/javascript/bumpVersion/bumpVersion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ if (!semanticVersionLevel || !Object.keys(versionUpdater.SEMANTIC_VERSION_LEVELS
console.log(`Invalid input for 'SEMVER_LEVEL': ${semanticVersionLevel}`, `Defaulting to: ${semanticVersionLevel}`);
}

const {version: previousVersion} = JSON.parse(fs.readFileSync('./package.json').toString());
const {version: previousVersion}: {version: string} = JSON.parse(fs.readFileSync('./package.json').toString());
const newVersion = versionUpdater.incrementVersion(previousVersion, semanticVersionLevel);
console.log(`Previous version: ${previousVersion}`, `New version: ${newVersion}`);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const run = () => {

// Extract timestamp, Graphite accepts timestamp in seconds
if (current.metadata?.creationDate) {
timestamp = Math.floor(new Date(current.metadata.creationDate).getTime() / 1000);
timestamp = Math.floor(new Date(current.metadata.creationDate as string).getTime() / 1000);
}

if (current.name && current.meanDuration && current.meanCount && timestamp) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ if (!semverLevel || !Object.values<string>(versionUpdater.SEMANTIC_VERSION_LEVEL
core.setFailed(`'Error: Invalid input for 'SEMVER_LEVEL': ${semverLevel}`);
}

const {version: currentVersion} = JSON.parse(readFileSync('./package.json', 'utf8'));
const {version: currentVersion}: {version: string} = JSON.parse(readFileSync('./package.json', 'utf8'));
const previousVersion = versionUpdater.getPreviousVersion(currentVersion, semverLevel);
core.setOutput('PREVIOUS_VERSION', previousVersion);
2 changes: 1 addition & 1 deletion .github/scripts/detectRedirectCycle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function detectCycle(): boolean {

fs.createReadStream(`${process.cwd()}/docs/redirects.csv`)
.pipe(parser)
.on('data', (row) => {
.on('data', (row: [string, string]) => {
// Create a directed graph of sourceURL -> targetURL
addEdge(row[0], row[1]);
})
Expand Down
2 changes: 1 addition & 1 deletion desktop/contextBridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ contextBridge.exposeInMainWorld('electron', {
}

// Deliberately strip event as it includes `sender`
ipcRenderer.on(channel, (event, ...args) => func(...args));
ipcRenderer.on(channel, (event, ...args: unknown[]) => func(...args));
},

/** Remove listeners for a single channel from the main process and sent to the renderer process. */
Expand Down
4 changes: 2 additions & 2 deletions desktop/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ const mainWindow = (): Promise<void> => {
app.hide();
}

ipcMain.on(ELECTRON_EVENTS.LOCALE_UPDATED, (event, updatedLocale) => {
ipcMain.on(ELECTRON_EVENTS.LOCALE_UPDATED, (event, updatedLocale: Locale) => {
Menu.setApplicationMenu(Menu.buildFromTemplate(localizeMenuItems(initialMenuTemplate, updatedLocale)));
disposeContextMenu();
disposeContextMenu = createContextMenu(updatedLocale);
Expand All @@ -601,7 +601,7 @@ const mainWindow = (): Promise<void> => {

// Listen to badge updater event emitted by the render process
// and update the app badge count (MacOS only)
ipcMain.on(ELECTRON_EVENTS.REQUEST_UPDATE_BADGE_COUNT, (event, totalCount) => {
ipcMain.on(ELECTRON_EVENTS.REQUEST_UPDATE_BADGE_COUNT, (event, totalCount?: number) => {
if (totalCount === -1) {
// The electron docs say you should be able to update this and pass no parameters to set the badge
// to a single red dot, but in practice it resulted in an error "TypeError: Insufficient number of
Expand Down
2 changes: 1 addition & 1 deletion src/components/Attachments/AttachmentCarousel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ function AttachmentCarousel({report, reportActions, parentReportActions, source,
}

if (onNavigate) {
onNavigate(entry.item);
onNavigate(entry.item as Attachment);
}
},
[isFullScreenRef, onNavigate],
Expand Down
2 changes: 1 addition & 1 deletion src/components/OfflineWithFeedback.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ function OfflineWithFeedback({
};

if (child.props.children) {
props.children = applyStrikeThrough(child.props.children);
props.children = applyStrikeThrough(child.props.children as React.ReactNode);
}

return React.cloneElement(child, props);
Expand Down
2 changes: 1 addition & 1 deletion src/libs/EmojiUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ function suggestEmojis(text: string, lang: Locale, limit: number = CONST.AUTO_CO
}
matching.push({code: node.metaData.code, name: node.name, types: node.metaData.types});
}
const suggestions = node.metaData.suggestions;
const suggestions: Emoji[] | undefined = node.metaData.suggestions;
if (!suggestions) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/libs/Environment/betaChecker/index.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function isBetaBuild(): IsBetaBuild {
fetch(CONST.GITHUB_RELEASE_URL)
.then((res) => res.json())
.then((json) => {
const productionVersion = json.tag_name;
const productionVersion: string | semver.SemVer = json.tag_name;
if (!productionVersion) {
AppUpdate.setIsAppInBeta(false);
resolve(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export default {
*/
clearNotifications(shouldClearNotification: (notificationData: LocalNotificationData) => boolean) {
Object.values(notificationCache)
.filter((notification) => shouldClearNotification(notification.data))
.filter((notification) => shouldClearNotification(notification.data as LocalNotificationData))
.forEach((notification) => notification.close());
},
};
2 changes: 1 addition & 1 deletion src/pages/home/report/ContextMenu/ContextMenuActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ const ContextMenuActions: ContextMenuAction[] = [
Clipboard.setString(Localize.translateLocal('iou.unheldExpense'));
} else if (content) {
setClipboardMessage(
content.replace(/(<mention-user>)(.*?)(<\/mention-user>)/gi, (match, openTag, innerContent, closeTag): string => {
content.replace(/(<mention-user>)(.*?)(<\/mention-user>)/gi, (match, openTag: string, innerContent: string, closeTag: string): string => {
const modifiedContent = Str.removeSMSDomain(innerContent) || '';
return openTag + modifiedContent + closeTag || '';
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,11 @@ type ComposerWithSuggestionsProps = ComposerWithSuggestionsOnyxProps &
policyID: string;
};

type SwitchToCurrentReportProps = {
preexistingReportID: string;
callback: () => void;
};

const {RNTextInputReset} = NativeModules;

const isIOSNative = getPlatform() === CONST.PLATFORM.IOS;
Expand Down Expand Up @@ -336,15 +341,15 @@ function ComposerWithSuggestions(

const debouncedSaveReportComment = useMemo(
() =>
lodashDebounce((selectedReportID, newComment) => {
lodashDebounce((selectedReportID: string, newComment: string | null) => {
Report.saveReportDraftComment(selectedReportID, newComment);
isCommentPendingSaved.current = false;
}, 1000),
[],
);

useEffect(() => {
const switchToCurrentReport = DeviceEventEmitter.addListener(`switchToPreExistingReport_${reportID}`, ({preexistingReportID, callback}) => {
const switchToCurrentReport = DeviceEventEmitter.addListener(`switchToPreExistingReport_${reportID}`, ({preexistingReportID, callback}: SwitchToCurrentReportProps) => {
if (!commentRef.current) {
callback();
return;
Expand Down
4 changes: 2 additions & 2 deletions src/pages/home/report/ReportActionsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -303,12 +303,12 @@ function ReportActionsList({
setCurrentUnreadMarker(null);
};

const unreadActionSubscription = DeviceEventEmitter.addListener(`unreadAction_${report.reportID}`, (newLastReadTime) => {
const unreadActionSubscription = DeviceEventEmitter.addListener(`unreadAction_${report.reportID}`, (newLastReadTime: string) => {
resetUnreadMarker(newLastReadTime);
setMessageManuallyMarkedUnread(new Date().getTime());
});

const readNewestActionSubscription = DeviceEventEmitter.addListener(`readNewestAction_${report.reportID}`, (newLastReadTime) => {
const readNewestActionSubscription = DeviceEventEmitter.addListener(`readNewestAction_${report.reportID}`, (newLastReadTime: string) => {
resetUnreadMarker(newLastReadTime);
setMessageManuallyMarkedUnread(0);
});
Expand Down

0 comments on commit 0f9ab4a

Please sign in to comment.