Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fluent-json-schema typescript error [help] #933

Closed
giovanni-bertoncelli opened this issue Sep 8, 2023 · 7 comments
Closed

Fluent-json-schema typescript error [help] #933

giovanni-bertoncelli opened this issue Sep 8, 2023 · 7 comments
Labels
help wanted Extra attention is needed

Comments

@giovanni-bertoncelli
Copy link

💬 Question here

I'm creating a demo project using Platformatic at the latest version (see package.json under). I'm creating some plugins for the project in which I'm using fluent-json-schema that seems to have some Typescript issue. In fact I'm receiving this error:

image

tsconfig.json:

{
  "compilerOptions": {
    "module": "commonjs",
    "esModuleInterop": true,
    "target": "es2020",
    "sourceMap": true,
    "pretty": true,
    "noEmitOnError": true,
    "incremental": true,
    "outDir": "dist"
  },
  "watchOptions": {
    "watchFile": "fixedPollingInterval",
    "watchDirectory": "fixedPollingInterval",
    "fallbackPolling": "dynamicPriority",
    "synchronousWatchDirectory": true,
    "excludeDirectories": [
      "**/node_modules",
      "dist"
    ]
  }
}

Package.json:

{
  "scripts": {
    "start": "platformatic start",
    "dev": "platformatic start --watch",
    "clean": "rm -fr ./dist",
    "build": "platformatic compile",
    "migrate": "platformatic db migrations apply"
  },
  "devDependencies": {
    "fastify": "^4.22.2",
    "typescript": "~5.2.0"
  },
  "dependencies": {
    "@fastify/autoload": "^5.7.1",
    "@fastify/env": "^4.2.0",
    "@fastify/oauth2": "^7.4.0",
    "@platformatic/db": "^0.40.0",
    "fastify-plugin": "^4.5.1",
    "fluent-json-schema": "^4.1.1",
    "platformatic": "^0.40.0"
  },
  "engines": {
    "node": "^18.8.0"
  }
}

Your Environment

  • node version: v18.17.1
  • fastify version: 4.22.2
  • os: Mac
@giovanni-bertoncelli giovanni-bertoncelli added the help wanted Extra attention is needed label Sep 8, 2023
@mcollina
Copy link
Member

mcollina commented Sep 8, 2023

Could you include a complete example?

@mcollina
Copy link
Member

mcollina commented Sep 8, 2023

A github repo will be fine.

@giovanni-bertoncelli
Copy link
Author

@giovanni-bertoncelli giovanni-bertoncelli changed the title Help Fluent-json-schema typescript error [help] Sep 8, 2023
@leorossi
Copy link

leorossi commented Sep 8, 2023

Found the bug

In fluent-json-schema type definition there are two interfaces called SchemaOptions

One is exported the other not.

Changing that file adding the missing export will make it work but of course we can't do that as it's an external dependency

any clue @mcollina ? Maybe a TS option to add?

@giovanni-bertoncelli
Copy link
Author

Maybe it can be declared only once?

@leorossi
Copy link

leorossi commented Sep 8, 2023

Opened a PR in fluent-json-schema to fix this.

@giovanni-bertoncelli
Copy link
Author

Thank you all @leorossi @mcollina

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants