Skip to content

Commit cc3f98d

Browse files
Copilotstipsan
andauthored
Fix noCheck warning when extract.checkTypes is false (#2403)
* Initial plan * Fix noCheck warning when extract.checkTypes is false Co-authored-by: stipsan <[email protected]> * Add changeset for noCheck warning fix Co-authored-by: stipsan <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: stipsan <[email protected]>
1 parent 73022b3 commit cc3f98d

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

.changeset/twelve-ideas-sort.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@sanity/pkg-utils': patch
3+
---
4+
5+
Fix noCheck warning when extract.checkTypes is false

packages/@sanity/pkg-utils/src/node/resolveBuildContext.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ export async function resolveBuildContext(options: {
4040
const strictOptions = parseStrictOptions(config?.strictOptions ?? {})
4141

4242
if (strictOptions.noCheckTypes !== 'off' && tsconfig?.options && config?.dts !== 'rolldown') {
43-
if (tsconfig.options.noCheck !== false && !tsconfig.options.noCheck) {
43+
if (tsconfig.options.noCheck !== false && !tsconfig.options.noCheck && config?.extract?.checkTypes !== false) {
4444
if (strictOptions.noCheckTypes === 'error') {
4545
throw new Error(
46-
'`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.',
46+
'`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.',
4747
)
4848
} else {
4949
logger.warn(
50-
'`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.',
50+
'`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.',
5151
)
5252
}
5353
}

0 commit comments

Comments
 (0)