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

need help with converting rxjs #330

Open
padzikm opened this issue Feb 20, 2020 · 2 comments
Open

need help with converting rxjs #330

padzikm opened this issue Feb 20, 2020 · 2 comments

Comments

@padzikm
Copy link

padzikm commented Feb 20, 2020

Hi, I tried to convert rx.js to .fs and result from ts2fable isn't helpful in seeing if that worked out. Trimmed output from running .\node_modules.bin\ts2fable.cmd .\node_modules\rxjs\index.d.ts fsharprx.fs -e rxjs:

createIExportsModule [rxjs], ./internal/observable/dom/fetch
createIExportsModule [rxjs], ./internal/observable/dom/webSocket
createIExportsModule [rxjs], ./internal/observable/dom/WebSocketSubject
unsupported printType ts2fable.Syntax.FsType.TODO:
unsupported printType ts2fable.Syntax.FsType.TODO:
unsupported printType ts2fable.Syntax.FsType.TODO:
ParamArray function is not an array type: combineLatest
ParamArray function is not an array type: combineLatest
ParamArray function is not an array type: combineLatest
ParamArray function is not an array type: combineLatest
unsupported printType ts2fable.Syntax.FsType.TODO:
unsupported printType ts2fable.Syntax.FsType.TODO:
unsupported printType ts2fable.Syntax.FsType.TODO:
ParamArray function is not an array type: forkJoin
unsupported printType ts2fable.Syntax.FsType.TODO:
unsupported printType ts2fable.Syntax.FsType.TODO:
ParamArray function is not an array type: onErrorResumeNext
unsupported printType ts2fable.Syntax.FsType.TODO:
ParamArray function is not an array type: zip
ParamArray function is not an array type: zip
ParamArray function is not an array type: combineLatest
ParamArray function is not an array type: concat
ParamArray function is not an array type: concat
unsupported printType ts2fable.Syntax.FsType.TODO:
ParamArray function is not an array type: endWith
unsupported printType ts2fable.Syntax.FsType.TODO:
unsupported printType ts2fable.Syntax.FsType.TODO:
unsupported printType ts2fable.Syntax.FsType.TODO:
ParamArray function is not an array type: merge
ParamArray function is not an array type: merge
ParamArray function is not an array type: onErrorResumeNext
ParamArray function is not an array type: onErrorResumeNextStatic
ParamArray function is not an array type: race
ParamArray function is not an array type: race
ParamArray function is not an array type: startWith
ParamArray function is not an array type: withLatestFrom
ParamArray function is not an array type: zip

what does it mean? is it ok and these are infos, or errors?

furthermore how can I reference library in fable? in outputed fsharprx.fs there are modules named like __internal_AsyncSubject which aren't named like original rx.js modules - could you give me example end to end how to work with ts2fable?

@padzikm padzikm changed the title Rxjs help with converting rxjs Feb 20, 2020
@padzikm padzikm changed the title help with converting rxjs need help with converting rxjs Feb 20, 2020
@humhei
Copy link
Contributor

humhei commented Feb 21, 2020

These are warning infos means that ts2fable has't yet imported the feature to parse the typescript systax,

createIExportsModule [rxjs], ./internal/observable/dom/fetch
createIExportsModule [rxjs], ./internal/observable/dom/webSocket
createIExportsModule [rxjs], ./internal/observable/dom/WebSocketSubject

Though multiple linked files feature is not well supported now..
You can manually edit the generated files to run JS codes.

For example,
Delete the codes
which has systax errors in Fsharp intellisence and you don't need to use them immediately

See https://fable.io/docs/communicate/js-from-fable.html#Type-safety-with-Imports-and-Interfaces
to learn how to interop with JS code in safety way

There are also some simple samples you can check from ts2fable online https://fable.io/ts2fable/

For the sample in this repository -----
Typescript is almostly fully generated by ts2fable

ts2fable using Typescript.fs to parse Typescript systax

https://github.com/fable-compiler/ts2fable/blob/master/src/TypeScript.fs#L12

let [<Import("*","typescript")>] ts: Ts.IExports = jsNative

ts.createProgram(ResizeArray tsPaths, options, host)

@padzikm
Copy link
Author

padzikm commented Feb 21, 2020

Are there any plans to support multiple linked files like in rx.js library? Changing by hand converted big library isn't good solution...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants