chore(deps): fix typescript configuration

This commit is contained in:
Luke Watts
2022-02-01 18:50:37 +01:00
parent 4b1b06d624
commit a58cb330ad
15 changed files with 85 additions and 22 deletions

View File

@@ -9,7 +9,7 @@ import {
IHowtoStats,
IUserDB,
IMapPin,
} from 'one-army-community-platform/lib/models'
} from '../../src/models'
export { DBDoc, IDBEndpoint, IEventDB, IHowtoDB, IHowtoStats, IUserDB, IMapPin }
import { generateDBEndpoints } from 'oa-shared'

View File

@@ -18,8 +18,8 @@ export const handleUserUpdates = functions.firestore
})
async function processHowToUpdates(change: IDBDocChange) {
const info: IUserDB = change.after.exists ? change.after.data() : {}
const prevInfo: IUserDB = change.before.exists ? change.before.data() : {}
const info = (change.after.exists ? change.after.data() : {}) as IUserDB
const prevInfo = (change.before.exists ? change.before.data() : {}) as IUserDB
// optional chaining (.?.) incase does not exists
const prevCountryCode = prevInfo.location?.countryCode
const newCountryCode = info.location?.countryCode

View File

@@ -13,7 +13,9 @@
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"resolveJsonModule": true
"resolveJsonModule": true,
"paths": {
}
},
"references": [
// these (should) be compiled ahead of functions, although can break: https://github.com/microsoft/TypeScript/issues/25864#issuecomment-596217193
@@ -21,6 +23,6 @@
{ "path": "../tsconfig.src-types.json" },
{ "path": "../shared/tsconfig.json" }
],
"include": ["src/**/*"],
"include": ["src/**/*", "../types"],
"exclude": ["src/**/*.test.tsx", "../src/**/*.test.tsx"]
}

View File

@@ -1,10 +1,10 @@
import * as React from 'react';
import { Icon, IGlyphs } from 'src/components/Icons'
import { Icon, IGlyphs } from '../Icons'
import {
Button as RebassButton,
ButtonProps as RebassButtonProps,
} from 'rebass/styled-components'
import Text from 'src/components/Text'
import Text from '../Text'
import styled from 'styled-components'
// extend to allow any default button props (e.g. onClick) to also be passed

View File

@@ -4,9 +4,9 @@ import styled from 'styled-components'
import { Button } from '../Button'
import 'react-image-lightbox/style.css'
import { ImageConverter } from './ImageConverter'
import theme from 'src/themes/styled.theme'
import theme from '../../themes/styled.theme'
import Dropzone from 'react-dropzone'
import { IUploadedFileMeta } from 'src/stores/storage'
import type { IUploadedFileMeta } from '../../stores/storage'
interface ITitleProps {
hasUploadedImg: boolean

View File

@@ -2,7 +2,7 @@ import {
Text as RebassText,
TextProps as RebassTextProps,
} from 'rebass/styled-components'
import theme from 'src/themes/styled.theme'
import theme from '../../themes/styled.theme'
import styled from 'styled-components'
export interface ITextProps {

View File

@@ -16,7 +16,7 @@ import type {
siteVariants,
} from './types';
import type { ConfigurationOption } from './constants';
import { UserRole } from 'src/models'
import { UserRole } from '../models'
/**
* Helper function to load configuration property

View File

@@ -1,6 +1,6 @@
import { ISelectedTags } from './tags.model'
import { DBDoc, ISODateString, IModerable } from './common.models'
import { ILocation } from 'src/models/common.models'
import { ILocation } from './common.models'
export interface IEvent extends IEventFormInput, IModerable {
_createdBy: string

View File

@@ -1,7 +1,7 @@
import { ISelectedTags } from './tags.model'
import { DBDoc, IModerable } from './common.models'
import { IConvertedFileMeta } from 'src/components/ImageInput/ImageInput'
import { IUploadedFileMeta } from 'src/stores/storage'
import type { IConvertedFileMeta } from '../components/ImageInput/ImageInput'
import type { IUploadedFileMeta } from '../stores/storage'
/**
* Comments are currently only used in Howtos.

View File

@@ -5,8 +5,8 @@ import {
DBDoc,
IModerationStatus,
} from './common.models'
import { IUploadedFileMeta } from 'src/stores/storage'
import { IConvertedFileMeta } from 'src/components/ImageInput/ImageInput'
import type { IUploadedFileMeta } from '../stores/storage'
import type { IConvertedFileMeta } from '../components/ImageInput/ImageInput'
export interface IUserState {
user?: IUser

View File

@@ -4,7 +4,7 @@
b) to enforce specific patterns when interacting with storage, such as setting metadata
*/
import { storage } from 'src/utils/firebase'
import { storage } from '../utils/firebase'
export class Storage {
/****************************************************************************** *

View File

@@ -1,4 +1,4 @@
import type { ThemeWithName } from "../types"
import { ThemeWithName } from "../types"
// use enum to specify list of possible colors for typing
export const colors = {

View File

@@ -1,4 +1,3 @@
import type { DefaultTheme } from 'styled-components'
interface LinkList {
label: string
url: string
@@ -16,6 +15,63 @@ export interface PlatformTheme {
externalLinks: LinkList[]
}
export interface ThemeWithName extends DefaultTheme {
export interface ThemeWithName {
name: string;
/**
* Following properties are taken from DefaultTheme
* exported from `styled-components`
*
* This should ideally be imported rather than manually
* inlined. However some behaviour is making this hard to
* achieve at the moment.
*/
typography: {
auxiliary: any
paragraph: any
},
colors: {
white: string
black: string
primary: string
softyellow: string
yellow: { base: string; hover: string }
blue: string
red: string
red2: string
softblue: string
bluetag: string
grey: string
green: string
error: string
background: string
silver: string
softgrey: string
offwhite: string
lightgrey: string
}
fontSizes: number[]
space: number[]
radii: number[]
zIndex: {
behind: number
level: number
default: number
slickArrows: number
modalProfile: number
logoContainer: number
mapFlexBar: number
header: number
modalBackdrop: number
modalContent: number
}
breakpoints: string[]
buttons: any
maxContainerWidth: number
regular: number
bold: number
}

View File

@@ -4,7 +4,7 @@ import 'firebase/auth'
import 'firebase/storage'
import 'firebase/functions'
import 'firebase/database'
import { FIREBASE_CONFIG, SITE } from 'src/config/config'
import { FIREBASE_CONFIG, SITE } from '../config/config'
// initialise with config settings, additional firestore config to support future changes
firebase.initializeApp(FIREBASE_CONFIG)

View File

@@ -17,7 +17,12 @@
"noImplicitAny": false,
"strictPropertyInitialization": false,
"experimentalDecorators": true,
"typeRoots": ["./node_modules/@types", "./types", "@testing-library/jest-dom"],
"typeRoots": [
"./node_modules/@types",
"./types",
"@testing-library/jest-dom",
"../src/themes/types"
],
"declaration": true,
"noEmit": true,
"noFallthroughCasesInSwitch": true,