Skip to content
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

Resolves initial setup and commit for adding typescript support to radon.js #55

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
10 changes: 8 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
"version": "3.2.22",
"description": "Radon is an object-oriented state management framework for JavaScript applications.",
"main": "build/bundle.js",
"typings": "types/index.d.ts",
"files": [
"build"
"build",
"types/*.d.ts"
],
"scripts": {
"test": "jest",
"test:types": "tsc -p ./types/test/tsconfig.json",
"test:siloNode": "jest siloNode.test.js",
"watch": "jest constructorNode.test.js --watch",
"test:virtualSilo": "jest virtualSilo.test.js --watch",
Expand Down Expand Up @@ -37,12 +40,15 @@
"devDependencies": {
"@babel/core": "^7.1.2",
"@babel/preset-env": "^7.1.0",
"@types/node": "^10.11.7",
"@types/webpack": "^4.4.16",
"babel-core": "^7.0.0-bridge.0",
"babel-preset-es2015-rollup": "^3.0.0",
"jest": "^23.6.0",
"jest-cli": "^23.6.0",
"rollup": "^0.66.2",
"rollup-plugin-babel": "^4.0.3",
"rollup-plugin-uglify": "^6.0.0"
"rollup-plugin-uglify": "^6.0.0",
"typescript": "^3.1.3"
}
}
3 changes: 3 additions & 0 deletions types/combineNodes.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export type combineNodes = (args: any) => any;


6 changes: 6 additions & 0 deletions types/constants.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//== maps[../radon/constants.js]

export const ARRAY : string;
export const OBJECT : string;
export const PRIMITIVE : string;
export const CONTAINER : string;
21 changes: 21 additions & 0 deletions types/constructorNode.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//== map[../radon/constructorNode.js]

export interface ConstructorNode {
name: string;

state: object;

parent: string;

readonly _name: string;

readonly _state: object;

readonly _parent: string;

initializeState(initialState: object) : void;

initializeModifiers(initialModifiers: object) : void;

constructor(name: string, parentName?: string) : void;
}
Empty file added types/index.d.ts
Empty file.
49 changes: 49 additions & 0 deletions types/siloNode.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
//== map[../radon/siloNode.js]
export interface SiloNode {
value: any;

name: string;

type: string;

modifiers: any;

parent: string;

devTool: string;

queue: Array<any>;

subscribers: Array<any>;

constructor(
name : string,
value: any,
parent: string | null,
modifiers: object,
type: string,
devTool: any | null) : void;

pushToSubscribers(renderFunction: Function) : void;

removeFromSubscribersAtIndex(index: number) : void;

issueID() : void;

notifySubscribers(): void;

runModifiers(): void;

deconstructObjectIntoSiloNodes(objName: string, objectToDeconstruct: any, parent: string | null, runLinkedMods: boolean) : object;

linkModifiers(nodeName: string, stateModifiers: any): void;

reconstruct(siloNodeName: any, currSiloNode: any) : any;

reconstructArray(siloNodeName: any, currSiloNode: any) : any;

reconstructObject(siloNodeName: any, currSiloNode: any) : any;

getState() : any;

}
20 changes: 20 additions & 0 deletions types/test/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"es2015"
],
"module": "commonjs",
"strict": true,
"noEmit": true,
"baseUrl": ".",
"paths": {
"radon": ["../index.d.ts"]
}
},
"files": [
"../index.d.ts"
],
"compileOnSave": false
}
11 changes: 11 additions & 0 deletions types/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"compilerOptions": {
"strict": true,
"lib": [
"es2015", "dom"
]
},
"include": [
"./*.ts"
]
}
4 changes: 4 additions & 0 deletions types/typings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "radon",
"main": "index.d.ts"
}
16 changes: 16 additions & 0 deletions types/virtualNode.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//== map[../radon/siloNode.js]
export interface VirtualNode {
id: number;

val: object;

name: string;

type: string;

parent: string;

parents: object;

updateTo(data: object): void;
}