refactor: Fix typescript build errors (#539)

This commit is contained in:
Andreas Eriksson 2021-11-15 23:36:26 +01:00 committed by GitHub
parent 4c58809ae6
commit d24347f272
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 20 additions and 8 deletions

View File

@ -20,7 +20,6 @@ import { defaultStackStyling } from '../design/navigationThemes'
import usePersonalStorage from '../hooks/usePersonalStorage'
import { Layout as LayoutStyle, Sizing, Typography } from '../styles'
import { studentName } from '../utils/peopleHelpers'
// @ts-expect-error Fix when migrating to TSX
import { useSMS } from '../utils/SMS'
import { translate } from '../utils/translation'
import { AlertIcon } from './icon.component'
@ -240,7 +239,7 @@ const Absence = () => {
</View>
</View>
)}
<Button onPress={handleSubmit} status="primary">
<Button onPress={() => handleSubmit()} status="primary">
{translate('general.send')}
</Button>
</View>

View File

@ -33,7 +33,6 @@ const randomWord = (
const randomIndex: number = Math.floor(Math.random() * keys.length)
const argumentKey: string = keys[randomIndex]
// @ts-expect-error Fix this later
return words[argumentKey]
}

View File

@ -125,6 +125,8 @@ const getRouteTitleFromName = (routeName: string) => {
return translate('navigation.menu')
case 'Classmates':
return translate('navigation.classmates')
default:
return ''
}
}

View File

@ -26,7 +26,7 @@ export const Classmates = () => {
const renderItemIcon = (props: IconProps) => (
<Icon {...props} name="people-outline" />
)
const [selected, setSelected] = React.useState()
const [selected, setSelected] = React.useState<Classmate>()
const renderItem = ({ item, index }: ListRenderItemInfo<Classmate>) => (
<ListItem
accessibilityLabel={`${translate('classmates.child')} ${index + 1}`}
@ -41,7 +41,7 @@ export const Classmates = () => {
<ContactMenu
contact={item}
selected={item === selected}
setSelected={setSelected}
setSelected={() => setSelected(undefined)}
/>
)}
/>

View File

@ -4,6 +4,17 @@
"outDir": "../../dist/out-tsc",
"types": ["node"]
},
"exclude": ["**/*.spec.ts", "**/*.spec.tsx"],
"exclude": [
"**/*.spec.ts",
"**/*.spec.tsx",
"**/*.spec.js",
"**/*.spec.jsx",
"**/*.test.ts",
"**/*.test.tsx",
"**/*.test.js",
"**/*.test.jsx",
"**/*.tests.ts",
"**/test-setup.ts"
],
"include": ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"]
}

View File

@ -2,6 +2,7 @@
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"noImplicitAny": false,
"jsx": "react-native",
"lib": ["dom", "esnext"],
"moduleResolution": "node",

View File

@ -295,9 +295,9 @@ export class Api extends EventEmitter {
public async getNewsDetails(
child: EtjanstChild,
item: NewsItem
): Promise<NewsItem | undefined > {
): Promise<NewsItem> {
if (this.isFake) {
return fakeResponse(fake.news(child).find((ni) => ni.id === item.id))
return fakeResponse(fake.news(child).find((ni) => ni.id === item.id) || {id: "", published: ""})
}
const url = routes.newsDetails(child.id, item.id)
const session = this.getRequestInit()