Skip to content

Update library to use typescript #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .babelrc

This file was deleted.

1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
10
8 changes: 8 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"arrowParens": "always",
"jsxBracketSameLine": false,
"printWidth": 80,
"parser": "typescript",
"singleQuote": true,
"trailingComma": "all"
}
40 changes: 31 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,44 @@
{
"name": "json-immutable",
"version": "0.4.0",
"main": "lib/index",
"version": "1.0.0",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"scripts": {
"prepublish": "babel src/ -d lib/",
"test": "npm run prepublish && ava"
"build": "tsc",
"lint-fix": "tslint -c ./tslint.json --project ./tsconfig.json --fix",
"lint": "tslint -c ./tslint.json --project ./tsconfig.json",
"prettier": "prettier \"src/**/*.{js,jsx,ts,tsx}\" --write",
"test": "npm run build && ava",
"typecheck": "tsc --noEmit --listFiles false"
},
"lint-staged": {
"{src}/**/*.{ts,tsx}": [
"prettier --write",
"git add"
]
},
"husky": {
"hooks": {
"pre-commit": "lint-staged",
"pre-push": "echo 'Running TSLint' && npm run lint && echo 'Running Typechecks' && npm run typecheck"
}
},
"peerDependencies": {
"immutable": "3.x.x"
},
"dependencies": {
"json-stream-stringify": "1.5.x"
"@types/node": "^11.10.0",
"json-stream-stringify": "^1.5.x"
},
"devDependencies": {
"ava": "0.16.x",
"babel-cli": "6.14.x",
"babel-preset-es2015": "6.14.x",
"immutable": "3.8.x"
"ava": "^1.2.1",
"husky": "^1.3.1",
"immutable": "3.8.x",
"lint-staged": "^8.1.5",
"prettier": "^1.16.4",
"tslint": "^5.13.1",
"tslint-config-prettier": "^1.18.0",
"typescript": "^3.3.3333"
},
"repository": {
"type": "git",
Expand Down
71 changes: 0 additions & 71 deletions src/deserialize.js

This file was deleted.

11 changes: 11 additions & 0 deletions src/deserialize.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { DeserializationOptions } from './types/options';
import { decodeData } from './utils/decoders';

export function deserialize(
json: string,
options: DeserializationOptions = {},
) {
return JSON.parse(json, (key, value) => {
return decodeData(key, value, options);
});
}
43 changes: 0 additions & 43 deletions src/helpers/native-type-helpers.js

This file was deleted.

4 changes: 0 additions & 4 deletions src/index.js

This file was deleted.

6 changes: 6 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export * from './deserialize';
export * from './serialize';

export * from './types/options';
export * from './types/serializedData';
export * from './types/iterableTypes';
Loading