Giter Club home page Giter Club logo

Comments (5)

dlubitz avatar dlubitz commented on May 31, 2024 1

I see! Thank you @mhsdesign
I was using the neos validators as blueprint, which were in TS 🤷‍♂️
E.g: https://github.com/neos/neos-ui/blob/8.3/packages/neos-ui-validators/src/DateTime/index.tsx

from neos-ui.

mhsdesign avatar mhsdesign commented on May 31, 2024

For me this is working fine … (8.2 and prev)

import I18n from "@neos-project/neos-ui-i18n";

const Lol () => <I18n is="foo" />

edit:

should work see:

'@neos-project/neos-ui-i18n': '@neos-project/neos-ui-extensibility/src/shims/neosProjectPackages/neos-ui-i18n/index',

and
https://github.com/neos/neos-ui/blob/8.3/packages/neos-ui-extensibility/src/shims/neosProjectPackages/neos-ui-i18n/index.js

from neos-ui.

dlubitz avatar dlubitz commented on May 31, 2024

I tried to import it in my custom validator (@neos-project/[email protected]), but it throwed the error:

Cannot find module '@neos-project/neos-ui-i18n' or its corresponding type declarations.

See:
https://github.com/VIVOMEDIA/neos-ui-json-validator/blob/use-i18n/Resources/Private/Validators/JsonValidator/src/JsonValidator/index.tsx

from neos-ui.

mhsdesign avatar mhsdesign commented on May 31, 2024

but its a ts error no?
so it doesn't keep you from actually working ^^

you may want to add a // @ts-ignore before the line
or add a d.ts file where you manually add a type declaration for the i18n:

neos.d.ts

declare module "@neos-project/neos-ui-i18n" {
    import React from "react";

    interface I18nProps {
        /**
         * Fallback key which gets rendered once the i18n service doesn't return a translation.
         */
        fallback?: string;

        /**
         * The target id which the i18n service accepts.
         */
        id?: string;

        /**
         * The destination paths for the package of the translation.
         */
        packageKey?: string;

        /**
         * The destination paths for the source of the translation.
         */
        sourceName?: string;

        /**
         * Additional parameters which are passed to the i18n service.
         */
        params?: object;

        /**
         * className which gets added to the translation span.
         */
        className?: string;
    }

    export default class I18n extends React.PureComponent<I18nProps> {}
}

from neos-ui.

mhsdesign avatar mhsdesign commented on May 31, 2024

Currently we offer no direct typescript support for plugins, so you need to come up with your own declarations (copy them from the Neos core)

from neos-ui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.