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

Specify compilerOptions via package.json config #2022

Closed
jlarmstrongiv opened this issue Jul 29, 2022 · 5 comments
Closed

Specify compilerOptions via package.json config #2022

jlarmstrongiv opened this issue Jul 29, 2022 · 5 comments
Labels
enhancement Improved functionality good first issue Easier issue for first time contributors help wanted Contributions are especially encouraged

Comments

@jlarmstrongiv
Copy link

jlarmstrongiv commented Jul 29, 2022

Search terms

error The 'compilerOptions' option must be a non-array object.

Expected Behavior

Typedoc works as expected:

npx typedoc --compilerOptions '{ "skipLibCheck": true }'

Actual Behavior

Typedoc errors with:

error The 'compilerOptions' option must be a non-array object.

Steps to reproduce the bug

npx typedoc --compilerOptions '{ "skipLibCheck": true }'

Environment

  • Typedoc version: 0.23.9
  • TypeScript version: 4.7.4
  • Node.js version: 16.15.0
  • OS: MacOS 12.4

Other

Really though, I would like to have skipLibCheck: false just like my tsconfig.json, but that gives me a long TypeScript ESLint error and I couldn’t find an exclude or excludePattern that ignored it.


> @configs/eslint@1.0.0 turbo:typedoc
> ../../../bin/typedoc/run

../../../node_modules/@types/eslint-scope/index.d.ts:12:5 - error TS2416: Property 'scopes' in type 'ScopeManager' is not assignable to the same property in base type 'ScopeManager'.
  Type 'import("/Users/user/project/node_modules/@types/eslint-scope/index").Scope[]' is not assignable to type 'import("/Users/user/project/node_modules/@types/eslint/index").Scope.Scope[]'.
    Type 'import("/Users/user/project/node_modules/@types/eslint-scope/index").Scope' is not assignable to type 'import("/Users/user/project/node_modules/@types/eslint/index").Scope.Scope'.
      Types of property 'variables' are incompatible.
        Type 'import("/Users/user/project/node_modules/@types/eslint-scope/index").Variable[]' is not assignable to type 'import("/Users/user/project/node_modules/@types/eslint/index").Scope.Variable[]'.
          Property 'scope' is missing in type 'import("/Users/user/project/node_modules/@types/eslint-scope/index").Variable' but required in type 'import("/Users/user/project/node_modules/@types/eslint/index").Scope.Variable'.

12     scopes: Scope[];
       ~~~~~~

  ../../../node_modules/@types/eslint/index.d.ts:88:9
    88         scope: Scope;
               ~~~~~
    'scope' is declared here.

../../../node_modules/@types/eslint-scope/index.d.ts:13:5 - error TS2416: Property 'globalScope' in type 'ScopeManager' is not assignable to the same property in base type 'ScopeManager'.
  Type 'import("/Users/user/project/node_modules/@types/eslint-scope/index").Scope' is not assignable to type 'import("/Users/user/project/node_modules/@types/eslint/index").Scope.Scope'.

13     globalScope: Scope;
       ~~~~~~~~~~~

../../../node_modules/@types/eslint-scope/index.d.ts:14:5 - error TS2416: Property 'acquire' in type 'ScopeManager' is not assignable to the same property in base type 'ScopeManager'.
  Type '(node: {}, inner?: boolean | undefined) => Scope | null' is not assignable to type '(node: Node, inner?: boolean | undefined) => Scope | null'.
    Type 'import("/Users/user/project/node_modules/@types/eslint-scope/index").Scope | null' is not assignable to type 'import("/Users/user/project/node_modules/@types/eslint/index").Scope.Scope | null'.
      Type 'import("/Users/user/project/node_modules/@types/eslint-scope/index").Scope' is not assignable to type 'import("/Users/user/project/node_modules/@types/eslint/index").Scope.Scope'.

14     acquire(node: {}, inner?: boolean): Scope | null;
       ~~~~~~~

../../../node_modules/@types/eslint-scope/index.d.ts:15:5 - error TS2416: Property 'getDeclaredVariables' in type 'ScopeManager' is not assignable to the same property in base type 'ScopeManager'.
  Type '(node: {}) => Variable[]' is not assignable to type '(node: Node) => Variable[]'.
    Type 'import("/Users/user/project/node_modules/@types/eslint-scope/index").Variable[]' is not assignable to type 'import("/Users/user/project/node_modules/@types/eslint/index").Scope.Variable[]'.

15     getDeclaredVariables(node: {}): Variable[];
       ~~~~~~~~~~~~~~~~~~~~

../../../node_modules/@types/eslint-scope/index.d.ts:21:5 - error TS2416: Property 'upper' in type 'Scope' is not assignable to the same property in base type 'Scope'.
  Type 'import("/Users/user/project/node_modules/@types/eslint-scope/index").Scope | null' is not assignable to type 'import("/Users/user/project/node_modules/@types/eslint/index").Scope.Scope | null'.

21     upper: Scope | null;
       ~~~~~

../../../node_modules/@types/eslint-scope/index.d.ts:22:5 - error TS2416: Property 'childScopes' in type 'Scope' is not assignable to the same property in base type 'Scope'.
  Type 'import("/Users/user/project/node_modules/@types/eslint-scope/index").Scope[]' is not assignable to type 'import("/Users/user/project/node_modules/@types/eslint/index").Scope.Scope[]'.

22     childScopes: Scope[];
       ~~~~~~~~~~~

../../../node_modules/@types/eslint-scope/index.d.ts:23:5 - error TS2416: Property 'variableScope' in type 'Scope' is not assignable to the same property in base type 'Scope'.
  Type 'import("/Users/user/project/node_modules/@types/eslint-scope/index").Scope' is not assignable to type 'import("/Users/user/project/node_modules/@types/eslint/index").Scope.Scope'.

23     variableScope: Scope;
       ~~~~~~~~~~~~~

../../../node_modules/@types/eslint-scope/index.d.ts:25:5 - error TS2416: Property 'variables' in type 'Scope' is not assignable to the same property in base type 'Scope'.
  Type 'import("/Users/user/project/node_modules/@types/eslint-scope/index").Variable[]' is not assignable to type 'import("/Users/user/project/node_modules/@types/eslint/index").Scope.Variable[]'.

25     variables: Variable[];
       ~~~~~~~~~

../../../node_modules/@types/eslint-scope/index.d.ts:26:5 - error TS2416: Property 'set' in type 'Scope' is not assignable to the same property in base type 'Scope'.
  Type 'Map<string, import("/Users/user/project/node_modules/@types/eslint-scope/index").Variable>' is not assignable to type 'Map<string, import("/Users/user/project/node_modules/@types/eslint/index").Scope.Variable>'.
    Type 'import("/Users/user/project/node_modules/@types/eslint-scope/index").Variable' is not assignable to type 'import("/Users/user/project/node_modules/@types/eslint/index").Scope.Variable'.

26     set: Map<string, Variable>;
       ~~~

../../../node_modules/@types/eslint-scope/index.d.ts:27:5 - error TS2416: Property 'references' in type 'Scope' is not assignable to the same property in base type 'Scope'.
  Type 'import("/Users/user/project/node_modules/@types/eslint-scope/index").Reference[]' is not assignable to type 'import("/Users/user/project/node_modules/@types/eslint/index").Scope.Reference[]'.
    Type 'import("/Users/user/project/node_modules/@types/eslint-scope/index").Reference' is not assignable to type 'import("/Users/user/project/node_modules/@types/eslint/index").Scope.Reference'.
      Types of property 'from' are incompatible.
        Type 'import("/Users/user/project/node_modules/@types/eslint-scope/index").Scope' is not assignable to type 'import("/Users/user/project/node_modules/@types/eslint/index").Scope.Scope'.

27     references: Reference[];
       ~~~~~~~~~~

../../../node_modules/@types/eslint-scope/index.d.ts:28:5 - error TS2416: Property 'through' in type 'Scope' is not assignable to the same property in base type 'Scope'.
  Type 'import("/Users/user/project/node_modules/@types/eslint-scope/index").Reference[]' is not assignable to type 'import("/Users/user/project/node_modules/@types/eslint/index").Scope.Reference[]'.

28     through: Reference[];
       ~~~~~~~

../../../node_modules/@types/eslint-scope/index.d.ts:35:5 - error TS2416: Property 'references' in type 'Variable' is not assignable to the same property in base type 'Variable'.
  Type 'import("/Users/user/project/node_modules/@types/eslint-scope/index").Reference[]' is not assignable to type 'import("/Users/user/project/node_modules/@types/eslint/index").Scope.Reference[]'.

35     references: Reference[];
       ~~~~~~~~~~

../../../node_modules/@types/eslint-scope/index.d.ts:41:5 - error TS2416: Property 'from' in type 'Reference' is not assignable to the same property in base type 'Reference'.
  Type 'import("/Users/user/project/node_modules/@types/eslint-scope/index").Scope' is not assignable to type 'import("/Users/user/project/node_modules/@types/eslint/index").Scope.Scope'.

41     from: Scope;
       ~~~~

../../../node_modules/@types/eslint-scope/index.d.ts:42:5 - error TS2416: Property 'resolved' in type 'Reference' is not assignable to the same property in base type 'Reference'.
  Type 'import("/Users/user/project/node_modules/@types/eslint-scope/index").Variable | null' is not assignable to type 'import("/Users/user/project/node_modules/@types/eslint/index").Scope.Variable | null'.
    Type 'import("/Users/user/project/node_modules/@types/eslint-scope/index").Variable' is not assignable to type 'import("/Users/user/project/node_modules/@types/eslint/index").Scope.Variable'.

42     resolved: Variable | null;
       ~~~~~~~~
@jlarmstrongiv jlarmstrongiv added the bug Functionality does not match expectation label Jul 29, 2022
@Gerrit0
Copy link
Collaborator

Gerrit0 commented Jul 30, 2022

I'm not sure I want to add more special casing into the options parser... TypeScript does a similar thing, with a better error message when you do npx tsc --paths

Really though, I would like to have skipLibCheck: false just like my tsconfig.json,

TypeDoc's behavior should mirror tsc's. tsc -p tsconfig.json should be equivalent to typedoc --tsconfig tsconfig.json in terms of type checking. If this is not the case, that's a bug, please file with a repro!

I couldn’t find an exclude or excludePattern that ignored it.

exclude doesn't filter errors, it only filters entry points/included members for documentation.

@Gerrit0 Gerrit0 added enhancement Improved functionality and removed bug Functionality does not match expectation labels Jul 30, 2022
Gerrit0 added a commit that referenced this issue Jul 31, 2022
@jlarmstrongiv
Copy link
Author

exclude doesn't filter errors, it only filters entry points/included members for documentation.

That makes sense.

Am I able to specify the compiler options from the package.json? It doesn’t seem to work either.

{
  "typedoc": {
    "entryPoint": "src/index.d.cts",
    "compilerOptions": {
      "skipLibCheck": true
    }
  }
}

@jlarmstrongiv jlarmstrongiv changed the title Specify --compilerOptions via cli Specify compilerOptions via package.json config Aug 5, 2022
@Gerrit0
Copy link
Collaborator

Gerrit0 commented Aug 6, 2022

Currently no, not supported. That key only lets you set the name/entry point/readme. PR welcome if you'd like to add support for that though :)

src/lib/utils/entry-point

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Aug 6, 2022

One thing to note: that section of the package.json is only used in packages mode.

@Gerrit0 Gerrit0 added help wanted Contributions are especially encouraged good first issue Easier issue for first time contributors labels Aug 6, 2022
@Gerrit0
Copy link
Collaborator

Gerrit0 commented Oct 10, 2022

Regarding setting the compiler options from package.json - I changed my mind. #2061 should meet this need.

@Gerrit0 Gerrit0 closed this as not planned Won't fix, can't repro, duplicate, stale Oct 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improved functionality good first issue Easier issue for first time contributors help wanted Contributions are especially encouraged
Projects
No open projects
Development

No branches or pull requests

2 participants