rsnext/packages/next/pages
Will Heslam b3d9fd2a0d
Make getInlineScriptSource arg Readonly (#17281)
The rule [total-functions/no-unsafe-readonly-mutable-assignment](https://github.com/danielnixon/eslint-plugin-total-functions#total-functionsno-unsafe-readonly-mutable-assignment) triggers with this error message:
> Assigning a readonly type to a mutable type can lead to unexpected mutation in the readonly value

when invoking
```
      NextScript.getInlineScriptSource(this.props)
```
inside a `_document.tsx`'s render function.
due to `this.props` having the type:
```
props: Readonly<P> & Readonly<{ children?: ReactNode }>
```
in `@types/react`

On the other hand, this is a small, low-priority change (IMO), so an alternative work around is just to disable the lint rule for that line of course.

Lint, tests, and build passes.

Lint error was discovered using typescript@next, version `4.1.0-dev.20200921` and eslint-plugin-total-functions version `4.1.0`, but I tested the change to nextjs using typescript version `3.8.3`.
2020-11-05 12:03:45 +00:00
..
_app.tsx add NextWebVitalsMetric type for reportWebVitals (#14675) 2020-07-03 03:36:13 +00:00
_document.tsx Make getInlineScriptSource arg Readonly (#17281) 2020-11-05 12:03:45 +00:00
_error.tsx Add support for static 404 when _error does not have custom GIP (#11062) 2020-03-14 09:58:20 +01:00