TypeError: ConstructorSignature.__init__() got an unexpected keyword argument 'type_parameters'
Closed this issue · 1 comments
adaxi commented
If you take the reproducer in #2 and edit the sdk/src/index.ts
file to include:
export class X <S> {
[s: string]: S
}
export interface C2 <T> {
t: T
}
export abstract class Z <S> {
s: S
constructor(s: S) {
this.s = s
}
[s: string]: S
}
export abstract class A <T, S> {
t: T
s: S
constructor(t: T, s: S) {
this.t = t
this.s = s
}
doit<U>(t: U): U {
return t
}
}
export class B <T, S> {
t: T
s: S
constructor(t: T, s: S) {
this.t = t
this.s = s
}
doit<U>(t: U): U {
return t
}
}
/**
* @class
*/
export class C extends B<string, string> {
_y?: number
set y (x: number) {
this.y = x
}
public u: C
constructor() {
super('1', '2')
this.u = this
}
}
You get the following error:
INFO - Cleaning site directory
INFO - Building documentation to directory: /home/gbo/Workspaces/reproducer/docs/site
INFO - griffe_typedoc: JSON written to /tmp/tmp29upt5ij
ERROR - Error reading page 'index.md': ConstructorSignature.__init__() got an unexpected keyword argument
'type_parameters'
Traceback (most recent call last):
File "/home/gbo/Workspaces/reproducer/docs/.venv/bin/mkdocs", line 8, in <module>
sys.exit(cli())
^^^^^
File "/home/gbo/Workspaces/reproducer/docs/.venv/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/gbo/Workspaces/reproducer/docs/.venv/lib/python3.11/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/home/gbo/Workspaces/reproducer/docs/.venv/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/gbo/Workspaces/reproducer/docs/.venv/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/gbo/Workspaces/reproducer/docs/.venv/lib/python3.11/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/gbo/Workspaces/reproducer/docs/.venv/lib/python3.11/site-packages/mkdocs/__main__.py", line 288, in build_command
build.build(cfg, dirty=not clean)
File "/home/gbo/Workspaces/reproducer/docs/.venv/lib/python3.11/site-packages/mkdocs/commands/build.py", line 310, in build
_populate_page(file.page, config, files, dirty)
File "/home/gbo/Workspaces/reproducer/docs/.venv/lib/python3.11/site-packages/mkdocs/commands/build.py", line 167, in _populate_page
page.render(config, files)
File "/home/gbo/Workspaces/reproducer/docs/.venv/lib/python3.11/site-packages/mkdocs/structure/pages.py", line 285, in render
self.content = md.convert(self.markdown)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/gbo/Workspaces/reproducer/docs/.venv/lib/python3.11/site-packages/markdown/core.py", line 357, in convert
root = self.parser.parseDocument(self.lines).getroot()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/gbo/Workspaces/reproducer/docs/.venv/lib/python3.11/site-packages/markdown/blockparser.py", line 117, in parseDocument
self.parseChunk(self.root, '\n'.join(lines))
File "/home/gbo/Workspaces/reproducer/docs/.venv/lib/python3.11/site-packages/markdown/blockparser.py", line 136, in parseChunk
self.parseBlocks(parent, text.split('\n\n'))
File "/home/gbo/Workspaces/reproducer/docs/.venv/lib/python3.11/site-packages/markdown/blockparser.py", line 158, in parseBlocks
if processor.run(parent, blocks) is not False:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/gbo/Workspaces/reproducer/docs/.venv/lib/python3.11/site-packages/mkdocstrings/extension.py", line 128, in run
html, handler, data = self._process_block(identifier, block, heading_level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/gbo/Workspaces/reproducer/docs/.venv/lib/python3.11/site-packages/mkdocstrings/extension.py", line 216, in _process_block
data: CollectorItem = handler.collect(identifier, options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/gbo/Workspaces/reproducer/docs/.venv/lib/python3.11/site-packages/mkdocstrings_handlers/typescript/handler.py", line 127, in collect
data = load_typedoc(["typedoc"])
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/gbo/Workspaces/reproducer/docs/.venv/lib/python3.11/site-packages/griffe_typedoc/loader.py", line 59, in load
return json.load(tmpfile, cls=TypedocDecoder)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/json/__init__.py", line 293, in load
return loads(fp.read(),
^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/json/__init__.py", line 359, in loads
return cls(**kw).decode(s)
^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/json/decoder.py", line 353, in raw_decode
obj, end = self.scan_once(s, idx)
^^^^^^^^^^^^^^^^^^^^^^
File "/home/gbo/Workspaces/reproducer/docs/.venv/lib/python3.11/site-packages/griffe_typedoc/decoder.py", line 542, in _object_hook
return _loader_map[kind](obj_dict, self._symbol_map)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/gbo/Workspaces/reproducer/docs/.venv/lib/python3.11/site-packages/griffe_typedoc/decoder.py", line 69, in wrapper
obj = func(obj_dict)
^^^^^^^^^^^^^^
File "/home/gbo/Workspaces/reproducer/docs/.venv/lib/python3.11/site-packages/griffe_typedoc/decoder.py", line 159, in _load_constructor_signature
return ConstructorSignature(**obj_dict)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: ConstructorSignature.__init__() got an unexpected keyword argument 'type_parameters'
pawamoy commented
Fixed in griffe-typedoc 0.0.0.0.2.8