Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

random error TS2345 type incompatible #39711

Open
bluelovers opened this issue Jul 23, 2020 · 0 comments
Open

random error TS2345 type incompatible #39711

bluelovers opened this issue Jul 23, 2020 · 0 comments
Labels
Needs Investigation This issue needs a team member to investigate its status.
Milestone

Comments

@bluelovers
Copy link
Contributor

TypeScript Version: 3.7.x-dev.201xxxxx

Search Terms:

Code

https://github.com/bluelovers/ws-glob/blob/fa6b1f033b353065dda276e524c680a81ee8c36d/packages/%40lazy-glob/rename/lib/util/globGroupsCollection.ts#L130-L149

		this._globPartsArray.forEach((g: IPartsPattern, idx) =>
		{
			// Use matches[idx + 1] because whole match is at index 0 of the array of matches
			if (g === EnumWildcard.Asterisk || g === EnumWildcard.QuestionMark)
			{
				this._groups.push(Object.freeze({
					type: EnumPartsAstType.wildcard,
					pattern: g,
					match: matches[idx + 1],
				}));
			}
			else
			{
				this._groups.push(Object.freeze({
					type: EnumPartsAstType.literal,
					pattern: g,
					match: matches[idx + 1],
				}));
			}
		});

Expected behavior:

no error by random happen

Actual behavior:

bandicam 2020-07-23 09-49-14-211.zip

Error:(143, 23) TS2345: Argument of type 'Readonly<{ type: EnumPartsAstType; pattern: string; match: string; }>' is not assignable to parameter of type 'Error | IAsterisk | IQuestionMark | ILiteral'.
  Type 'Readonly<{ type: EnumPartsAstType; pattern: string; match: string; }>' is not assignable to type 'ILiteral'.
    Types of property 'type' are incompatible.
      Type 'EnumPartsAstType' is not assignable to type 'EnumPartsAstType.literal'.

Playground Link:

Related Issues:

@RyanCavanaugh RyanCavanaugh added the Needs Investigation This issue needs a team member to investigate its status. label Jul 23, 2020
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Jul 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Investigation This issue needs a team member to investigate its status.
Projects
None yet
Development

No branches or pull requests

2 participants