• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

developit / preact / 2655
100%
master: 100%

Build:
Build:
LAST BUILD BRANCH: fix/inproper_unmount
DEFAULT BRANCH: master
Ran 03 Mar 2019 01:42AM UTC
Jobs 1
Files 18
Run time 6s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

pending completion
2655

push

travis-ci

andrewiggins
Enable Typescript to understand JSX default props

See https://github.com/Microsoft/TypeScript/pull/24422

This addition allows a Component to use defaultProps without having to
declare them as optional, in a nutshell:

Before

class Before extends Component<{ prop?: string }> {
	static defaultProps = {
		prop: "default value"
	};

	render() {
		// this.props.prop is string|undefined
	}
}

const element = <Before />;

After

class After extends Component<{ prop: string }> {
	static defaultProps = {
		prop: "default value"
	};

	render() {
		// typeof this.props.prop is string
	}
}

const element = <After />;

The definition isn't perfect, it doesn't quite understand type unions where
the type of a single property changes, e.g.

{ type: "number"; value: number } | { type: "string"; value: string }

But this case doesn't break, it just would require you to still provide
a property.

There might be some more things we can do with LibraryManagedAttributes,
it could allow the children property to be correct within Components
(always an Array) whilst still allowing components to specify the type
of children they accept.

650 of 695 branches covered (93.53%)

708 of 731 relevant lines covered (96.85%)

402.31 hits per line

Jobs
ID Job ID Ran Files Coverage
1 2655.1 03 Mar 2019 01:42AM UTC 0
96.85
Travis Job 2655.1
Source Files on build 2655
Detailed source file information is not available for this build.
  • Back to Repo
  • Travis Build #2655
  • f225aaaa on github
  • Prev Build on ceviche (#2652)
  • Next Build on ceviche (#2656)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc