types: use stricter defaults for component data and props

This commit is contained in:
Evan You
2018-10-04 17:33:20 -04:00
parent 05b70f790c
commit 511ac0bd2f
5 changed files with 29 additions and 19 deletions

View File

@@ -6,7 +6,9 @@ describe('attribute fallthrough', () => {
const nativeClick = jest.fn()
const childUpdated = jest.fn()
class Hello extends Component {
class Hello extends Component<{
count: number
}> {
data() {
return {
count: 0
@@ -27,7 +29,7 @@ describe('attribute fallthrough', () => {
}
}
class Child extends Component {
class Child extends Component<{}, { foo: number }> {
updated() {
childUpdated()
}
@@ -73,7 +75,7 @@ describe('attribute fallthrough', () => {
const nativeClick = jest.fn()
const childUpdated = jest.fn()
class Hello extends Component {
class Hello extends Component<{ count: number }> {
data() {
return {
count: 0
@@ -94,7 +96,7 @@ describe('attribute fallthrough', () => {
}
}
class Child extends Component {
class Child extends Component<{}, { foo: number }> {
static options = {
props: {
foo: Number
@@ -147,7 +149,7 @@ describe('attribute fallthrough', () => {
const childUpdated = jest.fn()
const grandChildUpdated = jest.fn()
class Hello extends Component {
class Hello extends Component<{ count: number }> {
data() {
return {
count: 0
@@ -182,7 +184,7 @@ describe('attribute fallthrough', () => {
}
}
class GrandChild extends Component {
class GrandChild extends Component<{}, { foo: number }> {
static options = {
props: {
foo: Number