diff --git a/.changeset/twelve-ideas-sort.md b/.changeset/twelve-ideas-sort.md new file mode 100644 index 000000000..19a11feca --- /dev/null +++ b/.changeset/twelve-ideas-sort.md @@ -0,0 +1,5 @@ +--- +'@sanity/pkg-utils': patch +--- + +Fix noCheck warning when extract.checkTypes is false diff --git a/packages/@sanity/pkg-utils/src/node/resolveBuildContext.ts b/packages/@sanity/pkg-utils/src/node/resolveBuildContext.ts index cb054caed..4ca642e7e 100644 --- a/packages/@sanity/pkg-utils/src/node/resolveBuildContext.ts +++ b/packages/@sanity/pkg-utils/src/node/resolveBuildContext.ts @@ -40,14 +40,14 @@ export async function resolveBuildContext(options: { const strictOptions = parseStrictOptions(config?.strictOptions ?? {}) if (strictOptions.noCheckTypes !== 'off' && tsconfig?.options && config?.dts !== 'rolldown') { - if (tsconfig.options.noCheck !== false && !tsconfig.options.noCheck) { + if (tsconfig.options.noCheck !== false && !tsconfig.options.noCheck && config?.extract?.checkTypes !== false) { if (strictOptions.noCheckTypes === 'error') { throw new Error( - '`noCheck` is not set to `true` in the tsconfig.json file used by `package.config.ts`. This makes generating dts files slower than it needs to be, as it will perform type checking on the dts files while at it.', + '`noCheck` is not set to `true` in the tsconfig.json file used by `package.config.ts`. This makes generating dts files slower than it needs to be, as it will perform type checking on the dts files while at it. You can set `noCheck: true` in tsconfig.json or set `extract: { checkTypes: false }` in package.config.ts to disable type checking.', ) } else { logger.warn( - '`noCheck` is not set to `true` in the tsconfig.json file used by `package.config.ts`. This makes generating dts files slower than it needs to be, as it will perform type checking on the dts files while at it.', + '`noCheck` is not set to `true` in the tsconfig.json file used by `package.config.ts`. This makes generating dts files slower than it needs to be, as it will perform type checking on the dts files while at it. You can set `noCheck: true` in tsconfig.json or set `extract: { checkTypes: false }` in package.config.ts to disable type checking.', ) } }