Skip to content

Commit

Permalink
🐛 Fix nbt paths ending with an enum type
Browse files Browse the repository at this point in the history
  • Loading branch information
misode committed Jul 4, 2024
1 parent 673b073 commit 0c0cca3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/mcdoc/src/runtime/checker/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -465,11 +465,15 @@ function checkShallowly<T>(
}

if (
(typeDef.kind === 'literal'
(typeDef.kind !== 'any' && typeDef.kind !== 'unsafe'
&& simplifiedInferred.kind !== 'unsafe'
&& typeDef.kind === 'literal'
&& (simplifiedInferred.kind !== 'literal'
|| typeDef.value.value !== simplifiedInferred.value.value))
// TODO handle enum field attributes
|| (typeDef.kind === 'enum'
|| (typeDef.kind !== 'any' && typeDef.kind !== 'unsafe'
&& simplifiedInferred.kind !== 'unsafe'
&& typeDef.kind === 'enum'
&& (simplifiedInferred.kind !== 'literal'
|| !typeDef.values.some(v => v.value === simplifiedInferred.value.value)))
) {
Expand Down

0 comments on commit 0c0cca3

Please sign in to comment.