-
Notifications
You must be signed in to change notification settings - Fork 53
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
build(tests): type check packages/neovim/*.test.ts #411
Conversation
"include": ["src", "**/api/Buffer.test.ts"], | ||
"exclude": ["node_modules", "__tests__", "**/*.test.ts", "examples", "lib"] | ||
"include": ["src"], | ||
"exclude": ["node_modules", "examples", "lib"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, so we can close #352 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really, still need to work on packages/integration-tests/.
@@ -218,7 +222,7 @@ describe('Neovim API', () => { | |||
const numWindows = (await nvim.windows).length; | |||
const buffer = await nvim.createBuffer(false, false); | |||
expect(await nvim.buffers).toHaveLength(numBuffers + 1); | |||
|
|||
assert(buffer instanceof Buffer); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if it's a typescript or tsserver bug, but locally I had to do this (similar for the other instanceof
checks below):
assert(buffer instanceof Buffer); | |
assert(typeof buffer !== 'number'); |
The nvim.openWindow
and related signatures are kind of weird.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's ok on my mac and ci. Anyway, I changed this to assert(typeof buffer !== 'number')
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The nvim.openWindow and related signatures are kind of weird.
Yeah, I think we can improve this in future.
@@ -232,7 +232,7 @@ export class Neovim extends BaseApi { | |||
/** | |||
* Sets the current tabpage | |||
*/ | |||
set tabpage(tabpage: AsyncTabpage) { | |||
set tabpage(tabpage: AsyncTabpage | Tabpage) { | |||
this.request(`${this.prefix}set_current_tabpage`, [tabpage]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if this and the buffer() case were a hidden bug. Do they need the same treatment as in window()? I don't see anywhere in this.request
codepath that would implicitly handle a Promise (AsyncBuffer/AsyncTabpage)
if (tabpage instanceof Tabpage) {
this.request(`${this.prefix}set_current_tabpage`, [tabpage]);
} else {
tabpage.then(tabpage => this.request(`${this.prefix}set_current_tabpage`, [tabpage]));
}
#411 (comment) doesn't need to block this, but might need a fix. |
Follow up #410, for #352.