Skip to content

Commit

Permalink
[C-3370] Fix harmony types (#6694)
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanjeffers authored Nov 15, 2023
1 parent 55f2957 commit 6947471
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 39 deletions.
43 changes: 28 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@
"rollup": "2.76.0",
"rollup-plugin-dts": "4.2.2",
"rollup-plugin-typescript2": "0.32.1",
"ttypescript": "^1.5.15",
"typescript-transform-paths": "^3.4.4"
"ttypescript": "1.5.15",
"typescript-transform-paths": "3.4.4"
},
"peerDependencies": {
"@reduxjs/toolkit": "1.6.1",
Expand Down
14 changes: 2 additions & 12 deletions packages/common/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import image from '@rollup/plugin-image'
import rollupTypescript from 'rollup-plugin-typescript2'
import ttypescript from 'ttypescript'

import pkg from './package.json'

Expand All @@ -22,18 +23,7 @@ export default [
],
plugins: [
rollupTypescript({
typescript: require('ttypescript'),
tsconfigDefaults: {
compilerOptions: {
plugins: [
{ transform: 'typescript-transform-paths' },
{
transform: 'typescript-transform-paths',
afterDeclarations: true
}
]
}
}
typescript: ttypescript
}),
image()
],
Expand Down
4 changes: 4 additions & 0 deletions packages/common/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
"utils/*": ["src/utils/*"],
"utils": ["src/utils"]
},
"plugins": [
{ "transform": "typescript-transform-paths" },
{ "transform": "typescript-transform-paths", "afterDeclarations": true }
],
"module": "esnext",
"target": "es6",
"moduleResolution": "node",
Expand Down
3 changes: 2 additions & 1 deletion packages/harmony/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,9 @@
"storybook-addon-smart-knobs": "6.0.2",
"storybook-dark-mode": "3.0.1",
"tsconfig-paths-webpack-plugin": "3.5.2",
"typescript": "4.9.4",
"ttypescript": "1.5.15",
"typescript-plugin-css-modules": "3.4.0",
"typescript-transform-paths": "3.4.4",
"webpack": "4.46.0"
},
"peerDependencies": {
Expand Down
6 changes: 3 additions & 3 deletions packages/harmony/rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import svgr from '@svgr/rollup'
import json from 'rollup-plugin-json'
import postcss from 'rollup-plugin-postcss'
import rollupTypescript from 'rollup-plugin-typescript2'
import typescript from 'typescript'
import ttypescript from 'ttypescript'

import pkg from './package.json' assert { type: 'json' }

Expand Down Expand Up @@ -34,8 +34,8 @@ export default {
}),
svgr(),
rollupTypescript({
clean: true,
typescript
typescript: ttypescript,
clean: true
})
],
external
Expand Down
2 changes: 1 addition & 1 deletion packages/harmony/src/components/avatar/Avatar.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import type { Meta, StoryObj } from '@storybook/react'
import { Box } from 'components/layout/Box'
import { Flex } from 'components/layout/Flex'
import { Paper } from 'components/layout/Paper'
// TODO: Get final image assets from Sammie
import shadowBackground from 'storybook/assets/shadowBackground.jpeg'
// TODO: Get final image assets from Sammie

import { Avatar } from './Avatar'

Expand Down
8 changes: 5 additions & 3 deletions packages/harmony/src/components/icon/Icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ export const iconSizes = {

type IconSize = keyof typeof iconSizes

type IconProps = {
type BaseIconProps = SVGProps<SVGSVGElement>

type IconProps = BaseIconProps & {
color?: IconColors
size?: IconSize
} & SVGProps<SVGSVGElement>
}

export type IconComponent = ComponentType<IconProps>
export type IconComponent = ComponentType<BaseIconProps | IconProps>

/**
* Renders a harmony Icon component
Expand Down
20 changes: 18 additions & 2 deletions packages/harmony/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"module": "esnext",
"sourceMap": true,
"checkJs": false,
"plugins": [{ "name": "typescript-plugin-css-modules" }],
"allowJs": false,
"jsx": "react-jsx",
"jsxImportSource": "@emotion/react",
Expand All @@ -14,7 +13,24 @@
"exactOptionalPropertyTypes": false,
"declaration": true,
"declarationMap": true,
"baseUrl": "./src",
"baseUrl": "./",
"paths": {
"foundations": ["src/foundations/index.ts"],
"foundations/*": ["src/foundations/*"],
"components": ["src/components/index.ts"],
"components/*": ["src/components/*"],
"icons": ["src/icons/index.ts"],
"icons/*": ["src/icons/*"],
"assets": ["src/assets/index.ts"],
"assets/*": ["src/assets/*"],
"storybook": ["src/storybook/index.ts"],
"storybook/*": ["src/storybook/*"]
},
"plugins": [
{ "name": "typescript-plugin-css-modules" },
{ "transform": "typescript-transform-paths" },
{ "transform": "typescript-transform-paths", "afterDeclarations": true }
],
"outDir": "build",
"declarationDir": "./",
"noPropertyAccessFromIndexSignature": false,
Expand Down

0 comments on commit 6947471

Please sign in to comment.