Skip to content

SetParameterType: compatible with break change about in typescript 5.4#835

Merged
sindresorhus merged 4 commits into
sindresorhus:mainfrom
Emiyaaaaa:fix/SetParameterType
Mar 18, 2024
Merged

SetParameterType: compatible with break change about in typescript 5.4#835
sindresorhus merged 4 commits into
sindresorhus:mainfrom
Emiyaaaaa:fix/SetParameterType

Conversation

@Emiyaaaaa

@Emiyaaaaa Emiyaaaaa commented Mar 18, 2024

Copy link
Copy Markdown
Collaborator
  1. Compatible with break change about the rest index in array in typescript 5.4

2. Replace npm test with npx tsc in github workflow to make testing more comprehensive

related #831

@Emiyaaaaa Emiyaaaaa changed the title SetParameter: compatible with break change about in typescript 5.4 SetParameterType: compatible with break change about in typescript 5.4 Mar 18, 2024
@Emiyaaaaa
Emiyaaaaa requested a review from sindresorhus March 18, 2024 09:14
Comment thread .github/workflows/main.yml Outdated
- run: npm install
- run: npm install typescript@${{ matrix.typescript-version }}
- run: npx tsc
- run: npm test

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes it test more than just typescript and may fail for unrelated reasons

@Emiyaaaaa Emiyaaaaa Mar 18, 2024

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about using npm test in ts-canary.yml?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As was mentioned in the issue, tsd ships with its own copy of typescript and as such isn't affected by any changes to the typescript dependency: #831 (comment)

One would instead have to do what I believe @shicks and @trevorade are doing: Use eg. expect-type instead: #499

And since expect-type is validated as part of running tsc itself, no changes to the GitHub Actions would be done then either.

That said: Replacing tsd with expect-type is a much broader topic, as highlighted by eg #499

Though: Since expect-type is already a dev dependency of type-fest as far as I remember it could be good to add a test using that and ensure that breaks the canary tests correctly, at least that way we won't see a regression again.

@voxpelli voxpelli Mar 18, 2024

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See

import {expectTypeOf} from 'expect-type';
and
import {expectTypeOf} from 'expect-type';

Though I'm a bit uncertain if those are actually run using tsc rather than tsd

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it

@Emiyaaaaa Emiyaaaaa Mar 18, 2024

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though I'm a bit uncertain if those are actually run using tsc rather than tsd

Unfortunately it's using tsd.

Directory test-d/ was excluded in tsconfig. https://github.com/sindresorhus/type-fest/blob/4f14bff7321b9a9876dca0719945423abd6b4da1/tsconfig.json#L14C2-L14C16

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants