Skip to content
This repository was archived by the owner on Apr 8, 2020. It is now read-only.

Conversation

@stephtr
Copy link
Contributor

@stephtr stephtr commented Jul 12, 2017

Would fix #1098 and all other templates.
Additionally I switched from requirejs and node definitions to webpack-env, which was used by the React templates and I think is the correct solution.
The Angular template still has an (external) error angular/#17863 remaining (only when compiling with strict flag).

if (module['hot']) {
module['hot'].accept();
module['hot'].dispose(() => {
if (module.hot) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

used node's definition, switched to webpack's


// Create browser history to use in the Redux store
const baseUrl = document.getElementsByTagName('base')[0].getAttribute('href');
const baseUrl = document.getElementsByTagName('base')[0].getAttribute('href')!;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When we assume that a base element exists, we can also assume that it has the href attribute set.

// This code starts up the React app when it runs in a browser. It sets up the routing
// configuration and injects the app into a DOM element.
const baseUrl = document.getElementsByTagName('base')[0].getAttribute('href');
const baseUrl = document.getElementsByTagName('base')[0].getAttribute('href')!;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When we assume that a base element exists, we can also assume that it has the href attribute set.

private renderPagination() {
let prevStartDateIndex = this.props.startDateIndex - 5;
let nextStartDateIndex = this.props.startDateIndex + 5;
let prevStartDateIndex = (this.props.startDateIndex || 0) - 5;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually startDateIndex gets set in componentWillMount by calling requestWeatherForecasts.


return platformDynamicServer(providers).bootstrapModule(AppModule).then(moduleRef => {
const appRef = moduleRef.injector.get(ApplicationRef);
const appRef: ApplicationRef = moduleRef.injector.get(ApplicationRef);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably because ApplicationRef is an abstract class this type wasn't inferred automatically.

@SteveSandersonMS
Copy link
Member

Thanks very much! This is great. It's now merged.

I also turned on strict mode for all the templates. In the Angular case, I also had to add skipLibCheck: true because of the Angular type definitions bug you mentioned. We can remove that line once Angular fixes the issue.

@stephtr stephtr deleted the patch-strict branch July 13, 2017 10:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

3 participants