Skip to content

Commit

Permalink
allow ignoring packages for @types/* major version compatability
Browse files Browse the repository at this point in the history
Reviewed By: LukeDefeo

Differential Revision: D48779653

fbshipit-source-id: ddea9730d1066212bfa7933df7f6a2c178e49766
  • Loading branch information
antonk52 authored and facebook-github-bot committed Sep 4, 2023
1 parent 8d0f3b2 commit 4ec84ca
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion desktop/scripts/verify-types-dependencies.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,23 @@ import cp from 'child_process';
import fs from 'fs-extra';
import semver from 'semver';

/**
* Lists all dependencies that DO NOT have to match their type declaration package major versions
*
* Leave a comment for packages that you list here
*/
const IGNORED_TYPES = new Set(
[
// node is not an installed package
'node',

// we are useing experimental versions of these packages
'react',
'react-dom',
'react-test-renderer',
].map((x) => `@types/${x}`),
);

type UnmatchedLibType = {
types: readonly [string, string];
lib: readonly [string, string];
Expand All @@ -29,7 +46,7 @@ function validatePackageJson(filepath: string): PackageJsonResult {
const typesPackages: Array<[string, string]> = [
...Object.entries(deps).filter(([k, v]) => k.startsWith('@types/')),
...Object.entries(devDeps).filter(([k, v]) => k.startsWith('@types/')),
];
].filter((x) => !IGNORED_TYPES.has(x[0]));

const unmatchedTypesPackages: UnmatchedLibType[] = typesPackages
.map(([rawName, rawVersion]) => {
Expand Down

0 comments on commit 4ec84ca

Please sign in to comment.