mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-02 16:29:47 +02:00
refactor: make entire project typecheck with root tsconfig (#7466)
This commit is contained in:
parent
89b0fff128
commit
2d94d575a1
17 changed files with 74 additions and 36 deletions
|
@ -67,9 +67,10 @@ const APITableRowComp = React.forwardRef(APITableRow);
|
|||
* should be generally correct in the MDX context.
|
||||
*/
|
||||
export default function APITable({children, name}: Props): JSX.Element {
|
||||
const [thead, tbody] = React.Children.toArray(
|
||||
children.props.children,
|
||||
) as ReactElement[];
|
||||
const [thead, tbody] = React.Children.toArray(children.props.children) as [
|
||||
ReactElement,
|
||||
ReactElement,
|
||||
];
|
||||
const highlightedRow = useRef<HTMLTableRowElement>(null);
|
||||
useEffect(() => {
|
||||
highlightedRow.current?.focus();
|
||||
|
|
|
@ -250,7 +250,7 @@ export default function ColorGenerator(): JSX.Element {
|
|||
setShades({
|
||||
...shades,
|
||||
[variableName]: {
|
||||
...shades[variableName],
|
||||
...shades[variableName]!,
|
||||
adjustmentInput: event.target.value,
|
||||
adjustment: Number.isNaN(newValue)
|
||||
? adjustment
|
||||
|
|
|
@ -23,7 +23,7 @@ function PackageJson() {
|
|||
// Only happens in deploy preview / local dev, but still nice
|
||||
const versionName =
|
||||
latestVersion.name === 'current' && allVersions.length > 1
|
||||
? allVersions[1].name
|
||||
? allVersions[1]!.name
|
||||
: latestVersion.name;
|
||||
return (
|
||||
<CodeBlock language="json" title="package.json">{`{
|
||||
|
|
|
@ -101,7 +101,7 @@ function MigrationAnnouncement() {
|
|||
function TweetsSection() {
|
||||
const tweetColumns: Array<Array<TweetItem>> = [[], [], []];
|
||||
Tweets.filter((tweet) => tweet.showOnHomepage).forEach((tweet, i) =>
|
||||
tweetColumns[i % 3].push(tweet),
|
||||
tweetColumns[i % 3]!.push(tweet),
|
||||
);
|
||||
|
||||
return (
|
||||
|
|
10
website/src/theme/theme.d.ts
vendored
Normal file
10
website/src/theme/theme.d.ts
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
declare module '@theme-original/ColorModeToggle' {
|
||||
export {default} from '@theme/ColorModeToggle';
|
||||
}
|
|
@ -85,12 +85,14 @@ export const darkStorage = createStorageSlot('ifm-theme-colors-dark', {
|
|||
persistence: 'sessionStorage',
|
||||
});
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
||||
export function getAdjustedColors(shades: Shades, baseColor: string) {
|
||||
export function getAdjustedColors(
|
||||
shades: Shades,
|
||||
baseColor: string,
|
||||
): (Shades[string] & {variableName: string; hex: string})[] {
|
||||
return Object.keys(shades).map((shade) => ({
|
||||
...shades[shade],
|
||||
...shades[shade]!,
|
||||
variableName: shade,
|
||||
hex: Color(baseColor).darken(shades[shade].adjustment).hex(),
|
||||
hex: Color(baseColor).darken(shades[shade]!.adjustment).hex(),
|
||||
}));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue