Skip to content

Commit

Permalink
Fix the @ts-ignore directive on TS import in type declaration output (
Browse files Browse the repository at this point in the history
#27)

* Fix the directive syntax for ignoring errors due to unavailable peer dependencies

* Add a changeset

* Update .changeset/serious-hotels-shake.md

---------

Co-authored-by: Phil Pluckthun <phil@kitten.sh>
  • Loading branch information
IvanUkhov and kitten authored Apr 18, 2024
1 parent 14b1a0c commit 0a4fef7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/serious-hotels-shake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@0no-co/graphql.web": patch
---

Fix `@ts-ignore` on TypeScript peer dependency import in typings not being applied due to a leading `!` character.
2 changes: 1 addition & 1 deletion scripts/rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ export default [
renderChunk(code, chunk) {
if (chunk.fileName.endsWith('d.ts')) {
const gqlImportRe = /(import\s+(?:[*\s{}\w\d]+)\s*from\s*'graphql';?)/g;
code = code.replace(gqlImportRe, x => '/*!@ts-ignore*/\n' + x);
code = code.replace(gqlImportRe, x => '/*@ts-ignore*/\n' + x);

code = prettier.format(code, {
filepath: chunk.fileName,
Expand Down

0 comments on commit 0a4fef7

Please sign in to comment.