Skip to content

Commit

Permalink
Upgraded to TypeScript 2.9
Browse files Browse the repository at this point in the history
  • Loading branch information
mweststrate committed Jun 5, 2018
1 parent 1be3976 commit 1547199
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 17 deletions.
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
"prettier.useTabs": false,
"prettier.printWidth": 100,
"prettier.singleQuote": false,
"typescript.tsdk": "node_modules/typescript/lib"
// "javascript.validate.enable": false // enable for flow
"typescript.tsdk": "node_modules/typescript/lib"
// "javascript.validate.enable": false // enable for flow
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"tape": "^4.2.2",
"ts-jest": "^22.0.0",
"tslib": "^1.7.1",
"typescript": "^2.1.4",
"typescript": "^2.9.0",
"uglify-es": "^3.3.9"
},
"dependencies": {},
Expand Down
2 changes: 1 addition & 1 deletion src/api/observabledecorator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function createDecoratorForEnhancer(enhancer: IEnhancer<any>): IObservabl
(
target: any,
propertyName: string,
descriptor: BabelDescriptor,
descriptor: BabelDescriptor | undefined,
_decoratorTarget,
decoratorArgs: any[]
) => {
Expand Down
2 changes: 1 addition & 1 deletion src/api/tojs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function toJSHelper(source, options: ToJSOptions, __alreadySeen: Map<any, any>)
export function toJS<T>(source: T, options?: ToJSOptions): T
export function toJS(source: any, options?: ToJSOptions): any
export function toJS(source, options: ToJSOptions) // internal overload
export function toJS(source, options: ToJSOptions) {
export function toJS(source, options?: ToJSOptions) {
if (!isObservable(source)) return source

// backward compatibility
Expand Down
6 changes: 3 additions & 3 deletions src/core/computedvalue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ export class ComputedValue<T> implements IObservable, IComputedValue<T>, IDeriva
__mapid = "#" + getNextId()
protected value: T | undefined | CaughtException = new CaughtException(null)
name: string
triggeredBy: string
triggeredBy?: string
isComputing: boolean = false // to check for cycles
isRunningSetter: boolean = false
derivation: () => T
setter: (value: T) => void
setter?: (value: T) => void
isTracing: TraceMode = TraceMode.NONE
public scope: Object | undefined
private equals: IEqualsComparer<any>
Expand All @@ -105,7 +105,7 @@ export class ComputedValue<T> implements IObservable, IComputedValue<T>, IDeriva
*/
constructor(options: IComputedValueOptions<T>) {
if (process.env.NODE_ENV !== "production" && !options.get)
return fail("missing option for computed: get")
throw "[mobx] missing option for computed: get"
this.derivation = options.get!
this.name = options.name || "ComputedValue@" + getNextId()
if (options.set) this.setter = createAction(this.name + "-setter", options.set) as any
Expand Down
2 changes: 1 addition & 1 deletion src/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export function isPropertyConfigurable(object: any, prop: PropertyKey): boolean
export function assertPropertyConfigurable(object: any, prop: PropertyKey) {
if (process.env.NODE_ENV !== "production" && !isPropertyConfigurable(object, prop))
fail(
`Cannot make property '${prop}' observable, it is not configurable and writable in the target object`
`Cannot make property '${prop.toString()}' observable, it is not configurable and writable in the target object`
)
}

Expand Down
11 changes: 6 additions & 5 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@
"version": "2.0.10",
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"moduleResolution": "node",
"alwaysStrict": true,
"outDir": "lib",
"sourceMap": false,
"declaration": true,
"module": "commonjs",
"removeComments": false,
"strictNullChecks": true,
"strict": true,
"noImplicitReturns": true,
"noImplicitUseStrict": true,
"noUnusedLocals": true,
"noUnusedParameters": false,
"noImplicitAny": false,
"moduleResolution": "node",
"downlevelIteration": true,
"noImplicitThis": false,
"lib": [
"es6"
]
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5834,9 +5834,9 @@ typedarray@~0.0.5:
version "0.0.6"
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"

typescript@^2.1.4:
version "2.8.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.8.3.tgz#5d817f9b6f31bb871835f4edf0089f21abe6c170"
typescript@^2.9.0:
version "2.9.1"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.9.1.tgz#fdb19d2c67a15d11995fd15640e373e09ab09961"

uglify-es@^3.3.9:
version "3.3.9"
Expand Down

2 comments on commit 1547199

@capaj
Copy link
Member

@capaj capaj commented on 1547199 Jun 5, 2018

Choose a reason for hiding this comment

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

is master still on such old typescript version? someone should update it there as well...

@mweststrate
Copy link
Member Author

@mweststrate mweststrate commented on 1547199 Jun 5, 2018 via email

Choose a reason for hiding this comment

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

Please sign in to comment.