diff --git a/packages/repo-tools/src/commands/api-reports/api-extractor.ts b/packages/repo-tools/src/commands/api-reports/api-extractor.ts index 46f4ea984b..2fba8eaf76 100644 --- a/packages/repo-tools/src/commands/api-reports/api-extractor.ts +++ b/packages/repo-tools/src/commands/api-reports/api-extractor.ts @@ -232,7 +232,8 @@ export async function createTemporaryTsConfig(includedPackageDirs: string[]) { extends: './tsconfig.json', include: [ // These two contain global definitions that are needed for stable API report generation - 'packages/cli/asset-types/asset-types.d.ts', + // eslint-disable-next-line no-restricted-syntax + `${resolvePath(__dirname)}/asset-types/asset-types.d.ts`, ...includedPackageDirs.map(dir => join(dir, 'src')), ], }); diff --git a/packages/repo-tools/src/commands/api-reports/asset-types/asset-types.d.ts b/packages/repo-tools/src/commands/api-reports/asset-types/asset-types.d.ts new file mode 100644 index 0000000000..0bd0922004 --- /dev/null +++ b/packages/repo-tools/src/commands/api-reports/asset-types/asset-types.d.ts @@ -0,0 +1,131 @@ +/* + * Copyright 2020 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* eslint-disable import/no-extraneous-dependencies */ + +/// +/// +/// + +declare module '*.bmp' { + const src: string; + export default src; +} + +declare module '*.gif' { + const src: string; + export default src; +} + +declare module '*.jpg' { + const src: string; + export default src; +} + +declare module '*.jpeg' { + const src: string; + export default src; +} + +declare module '*.png' { + const src: string; + export default src; +} + +declare module '*.webp' { + const src: string; + export default src; +} + +declare module '*.yaml' { + const src: string; + export default src; +} + +declare module '*.icon.svg' { + import { ComponentType } from 'react'; + import { SvgIconProps } from '@material-ui/core'; + + const Icon: ComponentType; + export default Icon; +} + +declare module '*.svg' { + const src: string; + export default src; +} + +declare module '*.eot' { + const src: string; + export default src; +} + +declare module '*.woff' { + const src: string; + export default src; +} + +declare module '*.woff2' { + const src: string; + export default src; +} + +declare module '*.ttf' { + const src: string; + export default src; +} + +declare module '*.css' { + const classes: { readonly [key: string]: string }; + export default classes; +} + +declare module '*.scss' { + const classes: { readonly [key: string]: string }; + export default classes; +} + +declare module '*.sass' { + const classes: { readonly [key: string]: string }; + export default classes; +} + +declare module '*.module.css' { + const classes: { readonly [key: string]: string }; + export default classes; +} + +declare module '*.module.scss' { + const classes: { readonly [key: string]: string }; + export default classes; +} + +declare module '*.module.sass' { + const classes: { readonly [key: string]: string }; + export default classes; +} + +// NOTE(freben): Both the fix, and the placement of the fix, are not great. +// +// The fix is because the PositionError was renamed to +// GeolocationPositionError outside of our control, and react-use is dependent +// on the old name. +// +// The placement is because it's the one location we have at the moment, where +// a central .d.ts file is imported by the frontend and can be amended. +// +// After both TS and react-use are bumped high enough, this should be removed. +type PositionError = GeolocationPositionError;