fastify / fast-json-stringify-compiler

Build and manage the fast-json-stringify instances for the fastify framework
MIT License
8 stars 3 forks source link

feat: standalone mode #18

Closed Eomm closed 2 years ago

Eomm commented 2 years ago

relates to https://github.com/fastify/fast-json-stringify/issues/506

Eomm commented 2 years ago

Why can't we write when file not exist? and use written file when possible?

We can but I think it is out of scope of this module. It is possible to build a specific schemaController that does it, all the API are in place

Eomm commented 2 years ago

typings are missing

I don't know how to do it due to the nature of this feature: require('@fastify/fast-json-stringify-compiler/standalone').

Could you guide me?

Uzlopak commented 2 years ago

You can create a standalone.d.ts next to the standalone.js.

Eomm commented 2 years ago

You can create a standalone.d.ts next to the standalone.js.

Do you have any more hints?

  test/types/standalone.test.ts:12:0
  ✖   6:15  This expression is not callable.
  Type typeof import("/Users/mspigolon/workspace/fast-json-stringify-compiler/standalone") has no call signatures.  
  ✖  12:0   Parameter type SerializerCompiler is not identical to argument type any.                                                                            
  ✖  14:15  This expression is not callable.
  Type typeof import("/Users/mspigolon/workspace/fast-json-stringify-compiler/standalone") has no call signatures.  
  ✖  21:0   Parameter type SerializerCompiler is not identical to argument type any.                                                                            

  standalone.d.ts:16:45
  ✖  16:45  Parameter Options implicitly has an any type.                                                                                                       

  5 errors
Uzlopak commented 2 years ago

I thought I am in my own repo

https://github.com/fastify/fast-json-stringify-compiler/commit/05a766039b933fc9c91b2fb5893c4f1250d6de43

Uzlopak commented 2 years ago

@Eomm https://github.com/fastify/fast-json-stringify-compiler/compare/standalone-feat...suggestion