google / google/closure-templates

TypeError: goog.isString is not a function

Open
#106 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
700
Forks
199
Avg merge
2d 12h
Merged PRs (30d)
26

Description

I ran into an issue where when I use Closure Templates standalone I get the following error: `test.js:20 Uncaught TypeError: goog.isString is not a function`

test.html

```

The Hello World of Closure Templates


document.write(examples.list());

```

test.soy

```
{namespace examples}

/**
* List
*/
{template .list private="true"}

    {call .item}
    {param title}
    {msg desc=""}Hello World{/msg}
    {/param}
    {param description}
    {msg desc=""}Lorem ipsum dolor sit amet{/msg}
    {/param}
    {param value: 1 /}
    {/call}


{/template}

/**
* List item
*/
{template .item private="true"}
{@param title: string}
{@param description: string}
{@param value: int}





  • {$title}



    {$description}


  • {/template}
    ```

    The idea here was that I wanted to make a template out of the list item structure. But I also need to localize some of the text.

    It wasn't clear to me how I could pass strings from `{msg}` as params - so I tried this which compiled, but fails in the browser because of missing `goog.isString`.

    Contributor guide

    Open the contributing guide

    Research direction

    Reproduce the browser failure using test.html, test.soy, the generated test.js, and soyutils.js, then inspect how the standalone runtime handles the compiled template and localized message parameters. Done means the example renders the list item in the browser without the goog.isString error and supports the intended localized text.

    Written by the indexing model from the issue text.

    Assessment

    Tech stack
    javascript
    Domain
    frontend, web-dev
    Issue type
    Bug
    Difficulty
    3/5
    Estimated time
    1-2 days
    Activity status
    Stale
    Clarity
    Mostly clear
    Newbie friendliness
    35/100

    Get new issues in your inbox

    A short digest of beginner-friendly GitHub issues.