Skip to content

Commit

Permalink
typescript related adjustments for new projects
Browse files Browse the repository at this point in the history
  • Loading branch information
izelnakri committed Mar 11, 2020
1 parent 760ddbe commit 17fd177
Show file tree
Hide file tree
Showing 15 changed files with 1,786 additions and 607 deletions.
2 changes: 0 additions & 2 deletions TODO
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
TODO: add qunit-dom.js to build system

TODO: add ember-test-helpers addon-test-helpers types to tsconfig


Expand Down
13 changes: 7 additions & 6 deletions ember-app-boilerplate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,19 @@
"repository": "",
"main": "src/main.js",
"scripts": {
"build": "mber build",
"start": "mber server",
"test": "mber test"
"typecheck": "node_modules/.bin/tsc --project tsconfig.json --noEmit",
"build": "node_modules/.bin/mber build",
"start": "node_modules/.bin/mber start",
"test": "node_modules/.bin/mber test"
},
"engines": {
"node": "^13.*"
},
"devDependencies": {
"mber": "{{mberVersion}}",
"eslint": "^6.8.0",
"eslint-plugin-ember": "^7.7.2",
"qunit-dom": "1.0.0",
"eslint-plugin-ember": "^7.10.1",
"qunit-dom": "1.1.0",
"@types/ember": "^3.1.1",
"@types/ember-data": "^3.1.9",
"@types/ember-qunit": "^3.4.7",
Expand All @@ -43,7 +44,7 @@
"memserver": "^2.0.10",
"abortcontroller-polyfill": "^1.4.0",
"ember-cli-fastboot": "^2.2.1",
"ember-data": "3.16.0",
"ember-data": "3.17.0",
"ember-devtools": "^6.0.0",
"ember-modifier": "^1.0.2",
"fastboot": "^3.0.0",
Expand Down
4 changes: 2 additions & 2 deletions ember-app-boilerplate/src/data/models/application/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ export default class ApplicationAdapter extends RESTAdapter {
// return { Authorization: `Bearer ${this.session.authenticationToken}` };
// }
// }
handleResponse(status, headers, payload) {
handleResponse(status, headers, payload, requestData) {
if (this.isInvalid(status, headers, payload)) {
const errors = errorsHashToArray(payload.errors);

return new InvalidError(errors);
}

return super.handleResponse(...arguments);
return super.handleResponse(status, headers, payload, requestData);
}
}
6 changes: 6 additions & 0 deletions ember-app-boilerplate/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@ import loadInitializers from 'ember-load-initializers';
import config from '../config/environment';

declare global {
interface FreeObject {
[propName: string]: any;
}

interface Window {
runningTests: any;
Ember: any;
DISABLE_MEMSERVER?: boolean;
MemServer?: FreeObject;
}
}

Expand Down
1 change: 1 addition & 0 deletions ember-app-boilerplate/src/resolver.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import Resolver from 'ember-resolver/resolvers/fallback';
import buildResolverConfig from 'ember-resolver/ember-config';
import config from '../config/environment';
Expand Down
1 change: 1 addition & 0 deletions ember-app-boilerplate/src/router.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import EmberRouter from '@ember/routing/router';
import DocumentationRouter from 'mber-documentation';
import ENV from '../config/environment';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import { VERSION } from '@ember/version';
import Component from '@glimmer/component';

Expand Down
25 changes: 13 additions & 12 deletions ember-app-boilerplate/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,23 @@
"allowJs": true,
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
"noImplicitAny": true,
"noImplicitThis": true,
"alwaysStrict": true,
"strictNullChecks": true,
"strictPropertyInitialization": true,
"noFallthroughCasesInSwitch": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noImplicitAny": false,
"noImplicitThis": false,
"alwaysStrict": false,
"strictNullChecks": false,
"strictPropertyInitialization": false,
"noFallthroughCasesInSwitch": false,
"noUnusedLocals": false,
"noUnusedParameters": false,
"noImplicitReturns": false,
"noEmitOnError": false,
"noEmit": true,
"inlineSourceMap": true,
"inlineSources": true,
"noEmit": false,
"inlineSourceMap": false,
"inlineSources": false,
"baseUrl": ".",
"module": "es6",
"experimentalDecorators": true,
"skipLibCheck": true,
"paths": {
"{{applicationName}}/tests/*": [
"tests/*"
Expand Down
2 changes: 0 additions & 2 deletions lib/addons/memserver/instance-initializers/memserver.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import require from 'require';
import { classify} from '@ember/string';
import { singularize } from 'ember-inflector';
import Memserver from 'memserver/server';

export default {
Expand Down
Loading

0 comments on commit 17fd177

Please sign in to comment.