mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 17:19:37 +02:00
Upgrade TypeScript to 5.8.3 (#24900)
GitOrigin-RevId: 80937de3dde14e21e02af2ecb93350b1fedafc82
This commit is contained in:
640
package-lock.json
generated
640
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -8,8 +8,8 @@
|
||||
"@types/chai": "^4.3.0",
|
||||
"@types/chai-as-promised": "^7.1.8",
|
||||
"@types/mocha": "^10.0.6",
|
||||
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
||||
"@typescript-eslint/parser": "^8.0.0",
|
||||
"@typescript-eslint/eslint-plugin": "^8.30.1",
|
||||
"@typescript-eslint/parser": "^8.30.1",
|
||||
"eslint": "^8.15.0",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"eslint-config-standard": "^17.0.0",
|
||||
@@ -23,7 +23,7 @@
|
||||
"eslint-plugin-promise": "^6.0.0",
|
||||
"eslint-plugin-unicorn": "^56.0.0",
|
||||
"prettier": "3.3.3",
|
||||
"typescript": "^5.5.4"
|
||||
"typescript": "^5.8.3"
|
||||
},
|
||||
"overrides": {
|
||||
"swagger-tools@0.10.4": {
|
||||
|
||||
@@ -30,9 +30,5 @@ export interface FileRenamed extends FileWithEditable {
|
||||
operation: Extract<FileOperation, 'renamed'>
|
||||
}
|
||||
|
||||
export type FileDiff =
|
||||
| FileAdded
|
||||
| FileRemoved
|
||||
| FileEdited
|
||||
| FileRenamed
|
||||
| FileUnchanged
|
||||
export type FileChanged = FileAdded | FileRemoved | FileEdited | FileRenamed
|
||||
export type FileDiff = FileChanged | FileUnchanged
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
import type {
|
||||
import {
|
||||
FileChanged,
|
||||
FileDiff,
|
||||
FileRemoved,
|
||||
FileRenamed,
|
||||
FileWithEditable,
|
||||
} from '../services/types/file'
|
||||
|
||||
export function isFileChanged(fileDiff: FileDiff): fileDiff is FileChanged {
|
||||
return 'operation' in fileDiff
|
||||
}
|
||||
|
||||
export function isFileRenamed(fileDiff: FileDiff): fileDiff is FileRenamed {
|
||||
return (fileDiff as FileRenamed).operation === 'renamed'
|
||||
return isFileChanged(fileDiff) && fileDiff.operation === 'renamed'
|
||||
}
|
||||
|
||||
export function isFileRemoved(fileDiff: FileDiff): fileDiff is FileRemoved {
|
||||
return (fileDiff as FileRemoved).operation === 'removed'
|
||||
}
|
||||
|
||||
function isFileWithEditable(fileDiff: FileDiff): fileDiff is FileWithEditable {
|
||||
return 'editable' in (fileDiff as FileWithEditable)
|
||||
return isFileChanged(fileDiff) && fileDiff.operation === 'removed'
|
||||
}
|
||||
|
||||
export function isFileEditable(fileDiff: FileDiff) {
|
||||
return isFileWithEditable(fileDiff)
|
||||
return 'editable' in fileDiff
|
||||
? fileDiff.editable
|
||||
: fileDiff.operation === 'edited'
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import _ from 'lodash'
|
||||
import type { FileDiff, FileRenamed } from '../services/types/file'
|
||||
import { isFileEditable, isFileRemoved } from './file-diff'
|
||||
import { isFileChanged, isFileEditable, isFileRemoved } from './file-diff'
|
||||
|
||||
export type FileTreeEntity = {
|
||||
name?: string
|
||||
@@ -65,22 +65,29 @@ export function fileTreeDiffToFileTreeData(
|
||||
const folders: HistoryFileTree[] = []
|
||||
const docs: HistoryDoc[] = []
|
||||
|
||||
for (const file of fileTreeDiff) {
|
||||
if (file.type === 'file') {
|
||||
const deletedAtV = isFileRemoved(file) ? file.deletedAtV : undefined
|
||||
|
||||
const newDoc: HistoryDoc = {
|
||||
pathname: file.pathname ?? '',
|
||||
name: file.name ?? '',
|
||||
deletedAtV,
|
||||
editable: isFileEditable(file),
|
||||
operation: 'operation' in file ? file.operation : undefined,
|
||||
for (const fileDiff of fileTreeDiff) {
|
||||
if (fileDiff.type === 'file') {
|
||||
if (isFileChanged(fileDiff)) {
|
||||
docs.push({
|
||||
pathname: fileDiff.pathname ?? '',
|
||||
name: fileDiff.name ?? '',
|
||||
editable: isFileEditable(fileDiff),
|
||||
operation: fileDiff.operation,
|
||||
deletedAtV: isFileRemoved(fileDiff) ? fileDiff.deletedAtV : undefined,
|
||||
})
|
||||
} else {
|
||||
docs.push({
|
||||
pathname: fileDiff.pathname ?? '',
|
||||
name: fileDiff.name ?? '',
|
||||
editable: isFileEditable(fileDiff),
|
||||
})
|
||||
}
|
||||
|
||||
docs.push(newDoc)
|
||||
} else if (file.type === 'folder') {
|
||||
if (file.children) {
|
||||
const folder = fileTreeDiffToFileTreeData(file.children, file.name)
|
||||
} else if (fileDiff.type === 'folder') {
|
||||
if (fileDiff.children) {
|
||||
const folder = fileTreeDiffToFileTreeData(
|
||||
fileDiff.children,
|
||||
fileDiff.name
|
||||
)
|
||||
folders.push(folder)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -312,13 +312,13 @@ type UserEmailsProviderProps = {
|
||||
children: React.ReactNode
|
||||
} & Record<string, unknown>
|
||||
|
||||
function UserEmailsProvider(props: UserEmailsProviderProps) {
|
||||
export function UserEmailsProvider(props: UserEmailsProviderProps) {
|
||||
const value = useUserEmails()
|
||||
|
||||
return <UserEmailsContext.Provider value={value} {...props} />
|
||||
}
|
||||
|
||||
const useUserEmailsContext = () => {
|
||||
export const useUserEmailsContext = () => {
|
||||
const context = useContext(UserEmailsContext)
|
||||
|
||||
if (context === undefined) {
|
||||
@@ -328,6 +328,4 @@ const useUserEmailsContext = () => {
|
||||
return context
|
||||
}
|
||||
|
||||
type EmailContextType = ReturnType<typeof useUserEmailsContext>
|
||||
|
||||
export { UserEmailsProvider, useUserEmailsContext, EmailContextType }
|
||||
export type EmailContextType = ReturnType<typeof useUserEmailsContext>
|
||||
|
||||
@@ -362,7 +362,7 @@
|
||||
"timekeeper": "^2.2.0",
|
||||
"to-string-loader": "^1.2.0",
|
||||
"tty-browserify": "^0.0.1",
|
||||
"typescript": "^5.0.4",
|
||||
"typescript": "^5.8.3",
|
||||
"uuid": "^9.0.1",
|
||||
"vitest": "^3.1.2",
|
||||
"w3c-keyname": "^2.2.8",
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "esnext" /* Specify ECMAScript target version */,
|
||||
"module": "es2020" /* Specify module code generation */,
|
||||
"module": "esnext" /* Specify module code generation */,
|
||||
"allowJs": true /* Allow JavaScript files to be compiled. */,
|
||||
// "checkJs": true /* Report errors in .js files. */,
|
||||
"jsx": "preserve" /* Specify JSX code generation */,
|
||||
"noEmit": true /* Do not emit outputs. */,
|
||||
"strict": true /* Enable all strict type-checking options. */,
|
||||
"moduleResolution": "node" /* Specify module resolution strategy */,
|
||||
"isolatedModules": true,
|
||||
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
|
||||
"skipLibCheck": true /* Skip type checking of declaration files. */,
|
||||
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */,
|
||||
|
||||
Reference in New Issue
Block a user