Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,14 @@ import {CloseButton} from '@instructure/ui-buttons'
const I18n = createI18nScope('conversations_2')

export const ALL_COURSES_ID = 'all_courses'
const ALL_COURSES_KEY = 'allCourses'

// @ts-expect-error TS7006 (typescriptify)
const filterOptions = (value, options) => {
const filteredOptions = {}
Object.keys(options).forEach(key => {
if (key === 'allCourses') {
// if provided, allCourses should always be present
if (key === ALL_COURSES_KEY) {
// if provided, ALL_COURSES_KEY should always be present

Copilot AI Apr 24, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The inline comment refers to the constant name (ALL_COURSES_KEY) rather than the actual option group (allCourses), which is a bit unclear to readers. Consider rewording it to describe the behavior (e.g., that the “All Courses” group should always be included when present) without referencing the internal constant name.

Suggested change
// if provided, ALL_COURSES_KEY should always be present
// Always include the "All Courses" group when it is provided.

Copilot uses AI. Check for mistakes.
// @ts-expect-error TS7053 (typescriptify)
filteredOptions[key] = options[key]
} else {
Expand Down Expand Up @@ -160,7 +161,7 @@ const CourseSelect = props => {

// @ts-expect-error TS2339 (typescriptify)
const contextName = option.contextName
const actualId = id === 'all_courses' ? null : id
const actualId = id === ALL_COURSES_ID ? null : id

props.onCourseFilterSelect({contextID: actualId, contextName})
setSelectedOptionId(actualId)
Expand Down Expand Up @@ -218,7 +219,7 @@ const CourseSelect = props => {
return I18n.t('Concluded Courses')
case 'groups':
return I18n.t('Groups')
case 'allCourses':
case ALL_COURSES_KEY:
return I18n.t('Courses')
}
}
Expand Down
21 changes: 11 additions & 10 deletions ui/features/inbox/react/containers/MessageListActionContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,17 @@ const MessageListActionContainer = props => {
data?.legacyNode?.favoriteCoursesConnection?.nodes,
)

// @ts-expect-error TS7034 (typescriptify)
const moreCourses = []
const concludedCourses = uniqueCourses.filter(course => {
if (course.concluded !== true) {
moreCourses.push(course)
return false
} else {
return true
}
})
const { concludedCourses, moreCourses } = uniqueCourses.reduce(
(acc, course) => {
if (course.concluded === true) {
acc.concludedCourses.push(course)
} else {
acc.moreCourses.push(course)
}
return acc
},
{ concludedCourses: [], moreCourses: [] }
)
Comment on lines +71 to +81

Copilot AI Apr 24, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reduce accumulator initializer uses empty array literals ({ concludedCourses: [], moreCourses: [] }). Under this repo’s strict TS settings, those often infer as never[], which makes the subsequent .push(course) lines type-error. Add an explicit accumulator type (or cast the empty arrays to the appropriate element type) so push is type-safe and avoids implicit never[] inference.

Copilot uses AI. Check for mistakes.

const courseSelectorOptions = {
allCourses: [
Expand Down