Commit 333043c0 authored by Lee ByeongJun's avatar Lee ByeongJun
Browse files

fix: remove redundant check

parent 8bb49415
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -80,6 +80,11 @@ To be released.
     render the favicon in terminal emulators that do not support 24-bit
     colors.  [[#168], [#282] by Hyeonseo Kim]

 -  Fixed TypeScript discriminated union type narrowing issues in codegen
    that occurred with Deno 2.4.2's stricter type checking.  Added type
    guard functions `isNonFunctionalProperty()` and `hasSingularAccessor()`
    to properly narrow `PropertySchema` types.  [[#303], [#305] by Lee ByeongJun]

[#168]: https://github.com/fedify-dev/fedify/issues/168
[#248]: https://github.com/fedify-dev/fedify/issues/248
[#260]: https://github.com/fedify-dev/fedify/issues/260
@@ -91,6 +96,8 @@ To be released.
[#285]: https://github.com/fedify-dev/fedify/pull/285
[#298]: https://github.com/fedify-dev/fedify/pull/298
[#300]: https://github.com/fedify-dev/fedify/pull/300
[#303]: https://github.com/fedify-dev/fedify/issues/303
[#305]: https://github.com/fedify-dev/fedify/pull/305


Version 1.7.5
+1 −1
Original line number Diff line number Diff line
@@ -155,7 +155,7 @@ export async function* generateConstructor(
        if ("${property.pluralName}" in values && \
            values.${property.pluralName} != null) {
      `;
      if (isNonFunctionalProperty(property) && property.singularAccessor) {
      if (property && property.singularAccessor) {
        yield `
          if ("${property.singularName}" in values &&
              values.${property.singularName} != null) {
+3 −0
Original line number Diff line number Diff line
@@ -89,6 +89,9 @@ export function getTypeId(
export function getTypeId(
  object: Object | Link | undefined | null,
): URL | undefined | null {
  // TODO: Deno 2.4.2's TypeScript doesn't properly narrow the type with `object == null` check,
  // so we need an explicit type assertion here. This should be revisited when upgrading
  // to newer versions that might fix this type narrowing issue.
  if (object == null) return object as undefined | null;
  const cls = object.constructor as
    & (new (...args: unknown[]) => Object | Link)