xhzq233 opened a new issue, #3668:
URL: https://github.com/apache/fory/issues/3668

   ### Search before asking
   
   I searched existing issues and couldn't find a duplicate.
   
   ### Version
   
   - Apache Fory commit: `33e0dc06` (upstream `main` as of 2026-05-11)
   - Component: JavaScript (`@apache-fory/core`)
   - Node.js: `v22.18.0`
   - OS: macOS (Darwin 24.6.0)
   
   ### Minimal reproduce step
   
   ```js
   const core = require("./javascript/packages/core/dist/index.js");
   const Fory = core.default;
   const { Type } = core;
   
   const fory = new Fory({ compatible: true });
   const serializer = fory.typeResolver.regenerateReadSerializer(
     Type.struct({ namespace: "demo", typeName: "repro_struct" }, {
       id: Type.int32(),
     }),
   );
   
   console.log("typeof getTypeInfo =", typeof serializer.getTypeInfo);
   serializer.getTypeInfo(); // throws
   ```
   
   Observed output on upstream main:
   
   ```text
   typeof getTypeInfo = undefined
   TypeError: serializer.getTypeInfo is not a function
   ```
   
   ### What did you expect to see?
   
   `regenerateReadSerializer()` should return a serializer that preserves the 
required serializer interface methods, including `getTypeInfo`.
   
   ### What did you see instead?
   
   In `javascript/packages/core/lib/typeResolver.ts`, 
`regenerateReadSerializer()` only forwards a subset of methods 
(`getHash/read/...`) to `registerSerializer(...)` and misses `getTypeInfo`.
   
   This can crash runtime paths that call `original.getTypeInfo()`, for example 
in `javascript/packages/core/lib/context.ts` 
(`getRegeneratedReadSerializerCache` / `genSerializerByTypeMetaRuntime`).
   
   ### Anything Else?
   
   I have a local fix ready and can submit a PR:
   
   ```ts
   return this.registerSerializer(typeInfo, {
     getHash: serializer.getHash,
     getTypeInfo: serializer.getTypeInfo,
     ...
   });
   ```
   
   ### Are you willing to submit a PR?
   
   - [x] I'm willing to submit a PR!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to