8000 fix: avoid accessing undeclared instance fields on type level by ktsn · Pull Request #189 · vuejs/composition-api · GitHub
[go: up one dir, main page]

Skip to content

fix: avoid accessing undeclared instance fields on type level #189

< 8000 div class="d-flex flex-order-2 flex-md-order-1 mx-2">
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

Merged
merged 2 commits into from
Feb 17, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix: avoid accessing undeclared instance fields on type level
  • Loading branch information
ktsn committed Nov 12, 2019
commit 3023f9f323e3ef6b809bca6e0b6c0e1c9cfd69e1
6 changes: 3 additions & 3 deletions src/component/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ interface ComponentOptionsWithProps<
setup?: SetupFunction<Props, RawBindings>;
}

interface ComponentOptionsWithoutProps<Props = never, RawBindings = Data> {
interface ComponentOptionsWithoutProps<Props = unknown, RawBindings = Data> {
props?: undefined;
setup?: SetupFunction<Props, RawBindings>;
}

// overload 1: object format with no props
export function createComponent<RawBindings>(
options: ComponentOptionsWithoutProps<never, RawBindings>
): VueProxy<never, RawBindings>;
options: ComponentOptionsWithoutProps<unknown, RawBindings>
): VueProxy<unknown, RawBindings>;
// overload 2: object format with object props declaration
// see `ExtractPropTypes` in ./componentProps.ts
export function createComponent<
Expand Down
2 changes: 1 addition & 1 deletion test/types/createComponent.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ describe('createComponent', () => {
const App = createComponent({
setup(props, ctx) {
isTypeEqual<SetupContext, typeof ctx>(true);
isTypeEqual<never, typeof props>(true);
isTypeEqual<unknown, typeof props>(true);
return () => null;
},
});
Expand Down
0