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

Types - Type 'string' is not assignable to type xxx #494

Closed
rodlukas opened this issue Jun 7, 2020 · 7 comments
Closed

Types - Type 'string' is not assignable to type xxx #494

rodlukas opened this issue Jun 7, 2020 · 7 comments

Comments

@rodlukas
Copy link

rodlukas commented Jun 7, 2020

Do you want to request a feature or report a bug?
bug with types

What is the current behavior?
toast.POSITION.xxx and toast.TYPE.xxx can't be passed to ToastContainer or toast() ->

  • Type 'string' is not assignable to type '"info" | "success" | "warning" | "error" | "default" | undefined'.
  • Type 'string' is not assignable to type '"top-right" | "top-center" | "top-left" | "bottom-right" | "bottom-center" | "bottom-left" | undefined'.
  • Type 'string' is not assignable to type '"top-right" | "top-center" | "top-left" | "bottom-right" | "bottom-center" | "bottom-left" | undefined'.ts(2322) index.d.ts(48, 5): The expected type comes from property 'position' which is declared here on type 'IntrinsicAttributes & ToastContainerProps & { children?: ReactNode; }'

the same issue (part of it) has already been fixed here - #470 - however it looks to me as not solved (in the latest 6.0.5 version) according to this simple codesandbox test - https://codesandbox.io/s/react-toastify-type-mismatch-33ulj?file=/src/index.tsx

import * as React from "react";
import { render } from "react-dom";
import { toast, ToastContainer } from "react-toastify";

const App: React.FunctionComponent<{}> = () => {
  function test() {
    toast("message", {
      type: toast.TYPE.INFO,
      position: toast.POSITION.BOTTOM_CENTER
    });
  }

  return (
    <ToastContainer
      position={toast.POSITION.TOP_CENTER}
      type={toast.TYPE.INFO}
    />
  );
};

render(<App />, document.getElementById("root"));

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React. Paste the link to your CodeSandbox (https://codesandbox.io/s/new) example below:

https://codesandbox.io/s/react-toastify-type-mismatch-33ulj?file=/src/index.tsx

What is the expected behavior?
toast.POSITION.xxx and toast.TYPE.xxx values should be allowed for use in ToastContainer and toast()

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
react-toastify 6.0.5

@rajeshde
Copy link

Do you want to request a feature or report a bug?
bug with types

What is the current behavior?
toast.POSITION.xxx and toast.TYPE.xxx can't be passed to ToastContainer or toast() ->

  • Type 'string' is not assignable to type '"info" | "success" | "warning" | "error" | "default" | undefined'.
  • Type 'string' is not assignable to type '"top-right" | "top-center" | "top-left" | "bottom-right" | "bottom-center" | "bottom-left" | undefined'.
  • Type 'string' is not assignable to type '"top-right" | "top-center" | "top-left" | "bottom-right" | "bottom-center" | "bottom-left" | undefined'.ts(2322) index.d.ts(48, 5): The expected type comes from property 'position' which is declared here on type 'IntrinsicAttributes & ToastContainerProps & { children?: ReactNode; }'

the same issue (part of it) has already been fixed here - #470 - however it looks to me as not solved (in the latest 6.0.5 version) according to this simple codesandbox test - https://codesandbox.io/s/react-toastify-type-mismatch-33ulj?file=/src/index.tsx

import * as React from "react";
import { render } from "react-dom";
import { toast, ToastContainer } from "react-toastify";

const App: React.FunctionComponent<{}> = () => {
  function test() {
    toast("message", {
      type: toast.TYPE.INFO,
      position: toast.POSITION.BOTTOM_CENTER
    });
  }

  return (
    <ToastContainer
      position={toast.POSITION.TOP_CENTER}
      type={toast.TYPE.INFO}
    />
  );
};

render(<App />, document.getElementById("root"));

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React. Paste the link to your CodeSandbox (https://codesandbox.io/s/new) example below:

https://codesandbox.io/s/react-toastify-type-mismatch-33ulj?file=/src/index.tsx

What is the expected behavior?
toast.POSITION.xxx and toast.TYPE.xxx values should be allowed for use in ToastContainer and toast()

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
react-toastify 6.0.5

Having same issues here.

@hisuwh
Copy link

hisuwh commented Jun 22, 2020

I'd raised another issue for this here:
#486

@redhoteggplant
Copy link

redhoteggplant commented Jul 2, 2020

Has anyone figured out a temporary workaround? Package is super great otherwise!

@fkhadra
Copy link
Owner

fkhadra commented Jul 2, 2020

I'll have a look at this ASAP.

@redhoteggplant
Copy link

Thank you so much! ❤️ We really appreciate your work on this

@fkhadra fkhadra closed this as completed in b4d2c25 Jul 2, 2020
@fkhadra
Copy link
Owner

fkhadra commented Jul 2, 2020

The issue should be solved with the release 6.0.7 that I've just pushed.

@rajeshde
Copy link

rajeshde commented Jul 2, 2020

This is solved!!!

Just checked with v6.0.7

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

5 participants