Repository: vuejs/composition-api (ts)

Issue:
Type of prop with a default value is incorrect
When upgrading to v1.0.0-rc.4, I'm getting a lot of type errors on components using props with a default value.
It looks like #655 introduced this regression.

Using the following component, the `props` argument of `setup()` is typed differently between rc.3 and rc.4:

```ts
export default defineComponent({
  props: {
    id: { type: String, default: 'def' },
    count: { type: Number, required: true },
  },
  setup(props) {},
});
```

rc.3: 
```ts
props: {
    id: string;
    count: number;
} & {}
```

rc.4: 
```ts
props: {
    count: number;
} & {
    id?: string | undefined;
}
```

rc.4 is incorrect here as the `id` prop will never be `undefined` at runtime, as it receives the default value if one wasn't provided.

Pull request description:
Revert "fix(types): RequiredKeys type"
Reverts vuejs/composition-api#655, close #658

Patch:
diff --git a/src/component/componentProps.ts b/src/component/componentProps.ts
index 85199e7..d01ee3e 100644
--- a/src/component/componentProps.ts
+++ b/src/component/componentProps.ts
@@ -27,7 +27,7 @@ type PropConstructor<T> =
   | { new (...args: string[]): Function }
 
 type RequiredKeys<T> = {
-  [K in keyof T]: T[K] extends { required: true } | { default: never } ? K : never
+  [K in keyof T]: T[K] extends { required: true } | { default: any } ? K : never
 }[keyof T]
 
 type OptionalKeys<T> = Exclude<keyof T, RequiredKeys<T>>


Test patch:
diff --git a/test-dts/defineComponent.test-d.ts b/test-dts/defineComponent.test-d.ts
index 3481e27..bdd033c 100644
--- a/test-dts/defineComponent.test-d.ts
+++ b/test-dts/defineComponent.test-d.ts
@@ -13,8 +13,8 @@ describe('with object props', () => {
     a?: number | undefined
     b: string
     e?: Function
-    bb?: string
-    bbb?: string
+    bb: string
+    bbb: string
     cc?: string[] | undefined
     dd: { n: 1 }
     ee?: () => string
@@ -24,8 +24,8 @@ describe('with object props', () => {
     eee: () => { a: string }
     fff: (a: number, b: string) => { a: boolean }
     hhh: boolean
-    ggg?: 'foo' | 'bar'
-    ffff?: (a: number, b: string) => { a: boolean }
+    ggg: 'foo' | 'bar'
+    ffff: (a: number, b: string) => { a: boolean }
     validated?: string
     date: Date
   }
diff --git a/test/types/defineComponent.spec.ts b/test/types/defineComponent.spec.ts
index d35d628..c41e08b 100644
--- a/test/types/defineComponent.spec.ts
+++ b/test/types/defineComponent.spec.ts
@@ -58,8 +58,8 @@ describe('defineComponent', () => {
       setup(props, ctx) {
         type PropsType = typeof props
         isTypeEqual<SetupContext, typeof ctx>(true)
-        isSubType<PropsType, { readonly b?: string; readonly a?: number }>(true)
-        isSubType<{ readonly b?: string; readonly a?: number }, PropsType>(true)
+        isSubType<PropsType, { readonly b?: string; readonly a: number }>(true)
+        isSubType<{ readonly b?: string; readonly a: number }, PropsType>(true)
         return () => null
       },
     })
@@ -191,12 +191,12 @@ describe('defineComponent', () => {
       setup(props) {
         type PropsType = typeof props
         isSubType<
-          { readonly foo: string; readonly bar?: string; readonly zoo?: string },
+          { readonly foo: string; readonly bar: string; readonly zoo?: string },
           PropsType
         >(true)
         isSubType<
           PropsType,
-          { readonly foo: string; readonly bar?: string; readonly zoo?: string }
+          { readonly foo: string; readonly bar: string; readonly zoo?: string }
         >(true)
         return () => null
       },