project-serum / serum-ts

Project Serum TypeScript monorepo
https://projectserum.com
Apache License 2.0
270 stars 245 forks source link

Typescript issue with buffer-layout #249

Open frolovdev opened 1 year ago

frolovdev commented 1 year ago

Hi there, thanks for the awesome library

The problem

version: 0.2.5

import * as borsh from "@project-serum/borsh";

borsh.struct([
    borsh.u8("variant"),
    borsh.str("title"),
    borsh.u8("rating"),
    borsh.str("description"),
  ]);

In such an example .struct and all other methods related to buffer-layout package literally treated as any

If we dive into the resulting package, we will see the next picture.

image

Proposed solution

Maybe it's a good idea to rely on an official fork of solana buffer-layout

https://github.com/solana-labs/buffer-layout

P.S.

I can help with pr for sure, but want to discuss it first

frolovdev commented 1 year ago

Made small research, the main problem with migrating to their solution is

https://github.com/solana-labs/buffer-layout/pull/4

Trying to force the merge by myself right now