Skip to content

Commit

Permalink
refactor: removes contextApiPatch.d.ts file from @casl/react to get r…
Browse files Browse the repository at this point in the history
…id of possible confusion in tools that can greedily include this file into compilation targets (#931)
  • Loading branch information
stalniy authored Jun 16, 2024
1 parent 37976b7 commit fdff316
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
else
if [ "$released_packages" != "" ]; then
echo -e "# Release notes for packages that will be published after merge\n\n" > release_notes.txt
echo "$release_notes" | sed 's/\x1B\[[0-9;]\{1,\}[A-Za-z]//g' | sed '/^##/,$!d' >> release_notes.txt
echo "$release_notes" | sed 's/\x1B\[[0-9;]\{1,\}[A-Za-z]//g' | sed -ne '/[0-9]*:[0-9]*:[0-9]* *[AP]M\] *\[semantic-release\] *› *ℹ *Release note for version/,$ p' >> release_notes.txt
gh pr comment "${{ github.event.pull_request.number }}" --body-file ./release_notes.txt
rm -f release_notes.txt
else
Expand Down
12 changes: 10 additions & 2 deletions packages/casl-react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,14 +205,22 @@ export default () => {

### Usage note on React < 16.4 with TypeScript

If you use TypeScript and React < 16.4 make sure to add `@casl/react/contextAPIPatch.d.ts` file in your `tscofig.json`, otherwise your app won't compile:
If you use TypeScript and React < 16.4 make sure to create a file `contextAPIPatch.d.ts` file with the next content:

```ts
declare module 'react' {
export type Consumer<T> = any;
}
```

and include it in your `tscofig.json`, otherwise your app won't compile:

```json
{
// other configuration options
"include": [
"src/**/*",
"@casl/react/contextAPIPatch.d.ts" // <-- add this line
"./contextAPIPatch.d.ts" // <-- add this line
]
}
```
Expand Down
3 changes: 0 additions & 3 deletions packages/casl-react/contextApiPatch.d.ts

This file was deleted.

0 comments on commit fdff316

Please sign in to comment.