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

Does not compile in typescript's strict mode #313

Open
mspoulsen opened this issue Jun 29, 2018 · 3 comments
Open

Does not compile in typescript's strict mode #313

mspoulsen opened this issue Jun 29, 2018 · 3 comments

Comments

@mspoulsen
Copy link

Motorcycle.ts does not compile if typescript script mode is turned on. Here is my tsconfig.json:

{
  "compilerOptions": {
    "lib": [
      "dom",
      "es5",
      "es2015"
    ],
    "target": "es5",
    "moduleResolution": "node",
    "module": "commonjs",
    "declaration": true,
    "noImplicitAny": true,
    "sourceMap": true,
    "noUnusedParameters": true,
    "noUnusedLocals": true,
    "strictNullChecks": true,
    "strict": true
  },
  "include": [
    "src/**/*.ts"
  ]
}

I get the following error:

TS2345: Argument of type '(VNode<HTMLHeadingElement, HTMLHeadingElementProperties> | VNode<HTMLButtonElement, HTMLButtonEle...' is not assignable to parameter of type 'HyperscriptChildren'.
  Type '(VNode<HTMLHeadingElement, HTMLHeadingElementProperties> | VNode<HTMLButtonElement, HTMLButtonEle...' is not assignable to type 'ReadonlyArray<string | VNode<Node, VNodeProps<Element, VNodeEvents<Element, ElementEventMap>>> | ...'.
    Types of property '[Symbol.iterator]' are incompatible.
      Type '() => IterableIterator<VNode<HTMLHeadingElement, HTMLHeadingElementProperties> | VNode<HTMLButton...' is not assignable to type '() => IterableIterator<string | VNode<Node, VNodeProps<Element, VNodeEvents<Element, ElementEvent...'.
        Type 'IterableIterator<VNode<HTMLHeadingElement, HTMLHeadingElementProperties> | VNode<HTMLButtonElemen...' is not assignable to type 'IterableIterator<string | VNode<Node, VNodeProps<Element, VNodeEvents<Element, ElementEventMap>>>...'.
          Type 'VNode<HTMLHeadingElement, HTMLHeadingElementProperties> | VNode<HTMLButtonElement, HTMLButtonElem...' is not assignable to type 'string | VNode<Node, VNodeProps<Element, VNodeEvents<Element, ElementEventMap>>> | null'.
            Type 'VNode<HTMLHeadingElement, HTMLHeadingElementProperties>' is not assignable to type 'string | VNode<Node, VNodeProps<Element, VNodeEvents<Element, ElementEventMap>>> | null'.
              Type 'VNode<HTMLHeadingElement, HTMLHeadingElementProperties>' is not assignable to type 'VNode<Node, VNodeProps<Element, VNodeEvents<Element,ElementEventMap>>>'.
                Type 'HTMLHeadingElementProperties' is not assignable to type 'VNodeProps<Element, VNodeEvents<Element, ElementEventMap>>'.
                  Types of property 'on' are incompatible.
                    Type 'VNodeEvents<HTMLHeadingElement, HTMLElementEventMap> | undefined' is not assignable to type 'VNodeEvents<Element, ElementEventMap>| undefined'.
                      Type 'VNodeEvents<HTMLHeadingElement, HTMLElementEventMap>' is not assignable to type 'VNodeEvents<Element, ElementEventMap> | undefined'.
                        Type 'VNodeEvents<HTMLHeadingElement, HTMLElementEventMap>' is not assignable to type 'VNodeEvents<Element, ElementEventMap>'.
                          Types of property '"ariarequest"' are incompatible.
                            Type 'EventHandler<HTMLHeadingElement, Event> | undefined' is not assignable to type 'EventHandler<Element, Event> | undefined'.
                              Type 'EventHandler<HTMLHeadingElement, Event>' is not assignable to type 'EventHandler<Element, Event> | undefined'.
                                Type 'EventHandler<HTMLHeadingElement, Event>' is not assignable to type 'EventHandler<Element, Event>'.
                                  Types of parameters 'event' and 'event' are incompatible.
                                    Type 'VNodeEvent<Element, Event>' is not assignable to type 'VNodeEvent<HTMLHeadingElement, Event>'.
                                      Type 'VNodeEvent<Element, Event>' is not assignable to type '{ target: HTMLHeadingElement; }'.
                                        Types of property 'target' are incompatible.
                                          Type 'EventTarget & Element' is not assignable to type 'HTMLHeadingElement'.
                                            Property 'align' is missing in type 'EventTarget & Element'.

In vscode it shows up like this (this is the counter example):

strict mode

@Frikki
Copy link
Member

Frikki commented Jul 1, 2018

Motorcycle.ts doesn’t support TS 2.9 yet.

@mspoulsen
Copy link
Author

mspoulsen commented Jul 2, 2018

I downgraded to Typescript 2.6.1. Now I get this error:
Cannot find module '/home/morten/pokerjuice/pj-analyze/.typed-test-evAh8h/src/common/streams'

There is some problem with @typed/test and absolute paths. I reported the issue here: TylorS167/typed-test#6

Anything that can be done about this? Atm I have to choose between using absolute paths and having tests 😮

@Frikki
Copy link
Member

Frikki commented Jul 3, 2018

I don’t know about this issue. We use @typed/test successfully in two current code bases using TS 2.9 and 2.8. However, motorcycle.ts is not involved in those projects.

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