-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
first pass at typescript and seamless immutable
- Loading branch information
Showing
6 changed files
with
79 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
export default config; | ||
|
||
/** | ||
* Type declarations for | ||
* import config from './config/environment' | ||
* | ||
* For now these need to be managed by the developer | ||
* since different ember addons can materialize new entries. | ||
*/ | ||
declare namespace config { | ||
export var environment: any; | ||
export var modulePrefix: string; | ||
export var podModulePrefix: string; | ||
export var locationType: string; | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import _ from 'lodash'; | ||
import * as SI from 'seamless-immutable'; | ||
|
||
const Immutable = SI['default'] ? SI['default'] : SI; | ||
|
||
const initialState = Immutable({ | ||
all: undefined, | ||
authenticatedId: undefined | ||
}); | ||
|
||
interface User { | ||
id: number; | ||
name: string; | ||
} | ||
|
||
interface Action { | ||
type: string; | ||
user: User; | ||
} | ||
|
||
interface UserState { | ||
all: Array<User>; | ||
authenticatedId: number; | ||
} | ||
|
||
export default ((state: SI.ImmutableObject<UserState>, action: Action): SI.ImmutableObject<UserState> => { | ||
switch(action.type) { | ||
case 'ASSIGN_USER': { | ||
const user = {[action.user.id]: action.user}; | ||
return state.merge({all: user, authenticatedId: action.user.id}); | ||
} | ||
default: { | ||
return state || initialState; | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,9 @@ | |
"test": "ember test" | ||
}, | ||
"devDependencies": { | ||
"@types/ember": "^2.7.34", | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
toranb
Author
Owner
|
||
"@types/lodash": "^4.14.64", | ||
"@types/seamless-immutable": "^6.1.2", | ||
"broccoli-asset-rev": "^2.4.5", | ||
"ember-cli": "2.13.1", | ||
"ember-cli-app-version": "^3.0.0", | ||
|
@@ -30,6 +33,7 @@ | |
"ember-cli-sass": "^6.1.2", | ||
"ember-cli-shims": "^1.1.0", | ||
"ember-cli-sri": "^2.1.0", | ||
"ember-cli-typescript": "^0.4.0", | ||
"ember-cli-uglify": "^1.2.0", | ||
"ember-component-css": "^0.3.3", | ||
"ember-export-application-global": "^2.0.0", | ||
|
@@ -49,7 +53,8 @@ | |
"normalizr": "^3.2.2", | ||
"redux": "^3.6.0", | ||
"redux-thunk": "^2.2.0", | ||
"reselect": "^2.5.4" | ||
"reselect": "^2.5.4", | ||
"typescript": "^2.1" | ||
}, | ||
"engines": { | ||
"node": ">= 4" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"compilerOptions": { | ||
"allowJs": true, | ||
"target": "es2015", | ||
"module": "es2015", | ||
"moduleResolution": "node", | ||
"suppressImplicitAnyIndexErrors": true, | ||
"allowSyntheticDefaultImports": true, | ||
"noImplicitAny": true, | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
toranb
Author
Owner
|
||
"noEmitOnError": false, | ||
"noEmit": true, | ||
"baseUrl": ".", | ||
"paths": { | ||
"welp/tests/*": ["tests/*"], | ||
"welp/*": ["app/*"] | ||
} | ||
}, | ||
"include": [ | ||
"app/**/*", | ||
"tests/**/*" | ||
] | ||
} |
um since when?